Initial creation.
This commit is contained in:
commit
fdb4e4cd36
355
GNU-FDL.txt
Normal file
355
GNU-FDL.txt
Normal file
@ -0,0 +1,355 @@
|
|||||||
|
GNU Free Documentation License
|
||||||
|
Version 1.1, March 2000
|
||||||
|
|
||||||
|
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
0. PREAMBLE
|
||||||
|
|
||||||
|
The purpose of this License is to make a manual, textbook, or other
|
||||||
|
written document "free" in the sense of freedom: to assure everyone
|
||||||
|
the effective freedom to copy and redistribute it, with or without
|
||||||
|
modifying it, either commercially or noncommercially. Secondarily,
|
||||||
|
this License preserves for the author and publisher a way to get
|
||||||
|
credit for their work, while not being considered responsible for
|
||||||
|
modifications made by others.
|
||||||
|
|
||||||
|
This License is a kind of "copyleft", which means that derivative
|
||||||
|
works of the document must themselves be free in the same sense. It
|
||||||
|
complements the GNU General Public License, which is a copyleft
|
||||||
|
license designed for free software.
|
||||||
|
|
||||||
|
We have designed this License in order to use it for manuals for free
|
||||||
|
software, because free software needs free documentation: a free
|
||||||
|
program should come with manuals providing the same freedoms that the
|
||||||
|
software does. But this License is not limited to software manuals;
|
||||||
|
it can be used for any textual work, regardless of subject matter or
|
||||||
|
whether it is published as a printed book. We recommend this License
|
||||||
|
principally for works whose purpose is instruction or reference.
|
||||||
|
|
||||||
|
|
||||||
|
1. APPLICABILITY AND DEFINITIONS
|
||||||
|
|
||||||
|
This License applies to any manual or other work that contains a
|
||||||
|
notice placed by the copyright holder saying it can be distributed
|
||||||
|
under the terms of this License. The "Document", below, refers to any
|
||||||
|
such manual or work. Any member of the public is a licensee, and is
|
||||||
|
addressed as "you".
|
||||||
|
|
||||||
|
A "Modified Version" of the Document means any work containing the
|
||||||
|
Document or a portion of it, either copied verbatim, or with
|
||||||
|
modifications and/or translated into another language.
|
||||||
|
|
||||||
|
A "Secondary Section" is a named appendix or a front-matter section of
|
||||||
|
the Document that deals exclusively with the relationship of the
|
||||||
|
publishers or authors of the Document to the Document's overall subject
|
||||||
|
(or to related matters) and contains nothing that could fall directly
|
||||||
|
within that overall subject. (For example, if the Document is in part a
|
||||||
|
textbook of mathematics, a Secondary Section may not explain any
|
||||||
|
mathematics.) The relationship could be a matter of historical
|
||||||
|
connection with the subject or with related matters, or of legal,
|
||||||
|
commercial, philosophical, ethical or political position regarding
|
||||||
|
them.
|
||||||
|
|
||||||
|
The "Invariant Sections" are certain Secondary Sections whose titles
|
||||||
|
are designated, as being those of Invariant Sections, in the notice
|
||||||
|
that says that the Document is released under this License.
|
||||||
|
|
||||||
|
The "Cover Texts" are certain short passages of text that are listed,
|
||||||
|
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||||
|
the Document is released under this License.
|
||||||
|
|
||||||
|
A "Transparent" copy of the Document means a machine-readable copy,
|
||||||
|
represented in a format whose specification is available to the
|
||||||
|
general public, whose contents can be viewed and edited directly and
|
||||||
|
straightforwardly with generic text editors or (for images composed of
|
||||||
|
pixels) generic paint programs or (for drawings) some widely available
|
||||||
|
drawing editor, and that is suitable for input to text formatters or
|
||||||
|
for automatic translation to a variety of formats suitable for input
|
||||||
|
to text formatters. A copy made in an otherwise Transparent file
|
||||||
|
format whose markup has been designed to thwart or discourage
|
||||||
|
subsequent modification by readers is not Transparent. A copy that is
|
||||||
|
not "Transparent" is called "Opaque".
|
||||||
|
|
||||||
|
Examples of suitable formats for Transparent copies include plain
|
||||||
|
ASCII without markup, Texinfo input format, LaTeX input format, SGML
|
||||||
|
or XML using a publicly available DTD, and standard-conforming simple
|
||||||
|
HTML designed for human modification. Opaque formats include
|
||||||
|
PostScript, PDF, proprietary formats that can be read and edited only
|
||||||
|
by proprietary word processors, SGML or XML for which the DTD and/or
|
||||||
|
processing tools are not generally available, and the
|
||||||
|
machine-generated HTML produced by some word processors for output
|
||||||
|
purposes only.
|
||||||
|
|
||||||
|
The "Title Page" means, for a printed book, the title page itself,
|
||||||
|
plus such following pages as are needed to hold, legibly, the material
|
||||||
|
this License requires to appear in the title page. For works in
|
||||||
|
formats which do not have any title page as such, "Title Page" means
|
||||||
|
the text near the most prominent appearance of the work's title,
|
||||||
|
preceding the beginning of the body of the text.
|
||||||
|
|
||||||
|
|
||||||
|
2. VERBATIM COPYING
|
||||||
|
|
||||||
|
You may copy and distribute the Document in any medium, either
|
||||||
|
commercially or noncommercially, provided that this License, the
|
||||||
|
copyright notices, and the license notice saying this License applies
|
||||||
|
to the Document are reproduced in all copies, and that you add no other
|
||||||
|
conditions whatsoever to those of this License. You may not use
|
||||||
|
technical measures to obstruct or control the reading or further
|
||||||
|
copying of the copies you make or distribute. However, you may accept
|
||||||
|
compensation in exchange for copies. If you distribute a large enough
|
||||||
|
number of copies you must also follow the conditions in section 3.
|
||||||
|
|
||||||
|
You may also lend copies, under the same conditions stated above, and
|
||||||
|
you may publicly display copies.
|
||||||
|
|
||||||
|
|
||||||
|
3. COPYING IN QUANTITY
|
||||||
|
|
||||||
|
If you publish printed copies of the Document numbering more than 100,
|
||||||
|
and the Document's license notice requires Cover Texts, you must enclose
|
||||||
|
the copies in covers that carry, clearly and legibly, all these Cover
|
||||||
|
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||||
|
the back cover. Both covers must also clearly and legibly identify
|
||||||
|
you as the publisher of these copies. The front cover must present
|
||||||
|
the full title with all words of the title equally prominent and
|
||||||
|
visible. You may add other material on the covers in addition.
|
||||||
|
Copying with changes limited to the covers, as long as they preserve
|
||||||
|
the title of the Document and satisfy these conditions, can be treated
|
||||||
|
as verbatim copying in other respects.
|
||||||
|
|
||||||
|
If the required texts for either cover are too voluminous to fit
|
||||||
|
legibly, you should put the first ones listed (as many as fit
|
||||||
|
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||||
|
pages.
|
||||||
|
|
||||||
|
If you publish or distribute Opaque copies of the Document numbering
|
||||||
|
more than 100, you must either include a machine-readable Transparent
|
||||||
|
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||||
|
a publicly-accessible computer-network location containing a complete
|
||||||
|
Transparent copy of the Document, free of added material, which the
|
||||||
|
general network-using public has access to download anonymously at no
|
||||||
|
charge using public-standard network protocols. If you use the latter
|
||||||
|
option, you must take reasonably prudent steps, when you begin
|
||||||
|
distribution of Opaque copies in quantity, to ensure that this
|
||||||
|
Transparent copy will remain thus accessible at the stated location
|
||||||
|
until at least one year after the last time you distribute an Opaque
|
||||||
|
copy (directly or through your agents or retailers) of that edition to
|
||||||
|
the public.
|
||||||
|
|
||||||
|
It is requested, but not required, that you contact the authors of the
|
||||||
|
Document well before redistributing any large number of copies, to give
|
||||||
|
them a chance to provide you with an updated version of the Document.
|
||||||
|
|
||||||
|
|
||||||
|
4. MODIFICATIONS
|
||||||
|
|
||||||
|
You may copy and distribute a Modified Version of the Document under
|
||||||
|
the conditions of sections 2 and 3 above, provided that you release
|
||||||
|
the Modified Version under precisely this License, with the Modified
|
||||||
|
Version filling the role of the Document, thus licensing distribution
|
||||||
|
and modification of the Modified Version to whoever possesses a copy
|
||||||
|
of it. In addition, you must do these things in the Modified Version:
|
||||||
|
|
||||||
|
A. Use in the Title Page (and on the covers, if any) a title distinct
|
||||||
|
from that of the Document, and from those of previous versions
|
||||||
|
(which should, if there were any, be listed in the History section
|
||||||
|
of the Document). You may use the same title as a previous version
|
||||||
|
if the original publisher of that version gives permission.
|
||||||
|
B. List on the Title Page, as authors, one or more persons or entities
|
||||||
|
responsible for authorship of the modifications in the Modified
|
||||||
|
Version, together with at least five of the principal authors of the
|
||||||
|
Document (all of its principal authors, if it has less than five).
|
||||||
|
C. State on the Title page the name of the publisher of the
|
||||||
|
Modified Version, as the publisher.
|
||||||
|
D. Preserve all the copyright notices of the Document.
|
||||||
|
E. Add an appropriate copyright notice for your modifications
|
||||||
|
adjacent to the other copyright notices.
|
||||||
|
F. Include, immediately after the copyright notices, a license notice
|
||||||
|
giving the public permission to use the Modified Version under the
|
||||||
|
terms of this License, in the form shown in the Addendum below.
|
||||||
|
G. Preserve in that license notice the full lists of Invariant Sections
|
||||||
|
and required Cover Texts given in the Document's license notice.
|
||||||
|
H. Include an unaltered copy of this License.
|
||||||
|
I. Preserve the section entitled "History", and its title, and add to
|
||||||
|
it an item stating at least the title, year, new authors, and
|
||||||
|
publisher of the Modified Version as given on the Title Page. If
|
||||||
|
there is no section entitled "History" in the Document, create one
|
||||||
|
stating the title, year, authors, and publisher of the Document as
|
||||||
|
given on its Title Page, then add an item describing the Modified
|
||||||
|
Version as stated in the previous sentence.
|
||||||
|
J. Preserve the network location, if any, given in the Document for
|
||||||
|
public access to a Transparent copy of the Document, and likewise
|
||||||
|
the network locations given in the Document for previous versions
|
||||||
|
it was based on. These may be placed in the "History" section.
|
||||||
|
You may omit a network location for a work that was published at
|
||||||
|
least four years before the Document itself, or if the original
|
||||||
|
publisher of the version it refers to gives permission.
|
||||||
|
K. In any section entitled "Acknowledgements" or "Dedications",
|
||||||
|
preserve the section's title, and preserve in the section all the
|
||||||
|
substance and tone of each of the contributor acknowledgements
|
||||||
|
and/or dedications given therein.
|
||||||
|
L. Preserve all the Invariant Sections of the Document,
|
||||||
|
unaltered in their text and in their titles. Section numbers
|
||||||
|
or the equivalent are not considered part of the section titles.
|
||||||
|
M. Delete any section entitled "Endorsements". Such a section
|
||||||
|
may not be included in the Modified Version.
|
||||||
|
N. Do not retitle any existing section as "Endorsements"
|
||||||
|
or to conflict in title with any Invariant Section.
|
||||||
|
|
||||||
|
If the Modified Version includes new front-matter sections or
|
||||||
|
appendices that qualify as Secondary Sections and contain no material
|
||||||
|
copied from the Document, you may at your option designate some or all
|
||||||
|
of these sections as invariant. To do this, add their titles to the
|
||||||
|
list of Invariant Sections in the Modified Version's license notice.
|
||||||
|
These titles must be distinct from any other section titles.
|
||||||
|
|
||||||
|
You may add a section entitled "Endorsements", provided it contains
|
||||||
|
nothing but endorsements of your Modified Version by various
|
||||||
|
parties--for example, statements of peer review or that the text has
|
||||||
|
been approved by an organization as the authoritative definition of a
|
||||||
|
standard.
|
||||||
|
|
||||||
|
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||||
|
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||||
|
of Cover Texts in the Modified Version. Only one passage of
|
||||||
|
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||||
|
through arrangements made by) any one entity. If the Document already
|
||||||
|
includes a cover text for the same cover, previously added by you or
|
||||||
|
by arrangement made by the same entity you are acting on behalf of,
|
||||||
|
you may not add another; but you may replace the old one, on explicit
|
||||||
|
permission from the previous publisher that added the old one.
|
||||||
|
|
||||||
|
The author(s) and publisher(s) of the Document do not by this License
|
||||||
|
give permission to use their names for publicity for or to assert or
|
||||||
|
imply endorsement of any Modified Version.
|
||||||
|
|
||||||
|
|
||||||
|
5. COMBINING DOCUMENTS
|
||||||
|
|
||||||
|
You may combine the Document with other documents released under this
|
||||||
|
License, under the terms defined in section 4 above for modified
|
||||||
|
versions, provided that you include in the combination all of the
|
||||||
|
Invariant Sections of all of the original documents, unmodified, and
|
||||||
|
list them all as Invariant Sections of your combined work in its
|
||||||
|
license notice.
|
||||||
|
|
||||||
|
The combined work need only contain one copy of this License, and
|
||||||
|
multiple identical Invariant Sections may be replaced with a single
|
||||||
|
copy. If there are multiple Invariant Sections with the same name but
|
||||||
|
different contents, make the title of each such section unique by
|
||||||
|
adding at the end of it, in parentheses, the name of the original
|
||||||
|
author or publisher of that section if known, or else a unique number.
|
||||||
|
Make the same adjustment to the section titles in the list of
|
||||||
|
Invariant Sections in the license notice of the combined work.
|
||||||
|
|
||||||
|
In the combination, you must combine any sections entitled "History"
|
||||||
|
in the various original documents, forming one section entitled
|
||||||
|
"History"; likewise combine any sections entitled "Acknowledgements",
|
||||||
|
and any sections entitled "Dedications". You must delete all sections
|
||||||
|
entitled "Endorsements."
|
||||||
|
|
||||||
|
|
||||||
|
6. COLLECTIONS OF DOCUMENTS
|
||||||
|
|
||||||
|
You may make a collection consisting of the Document and other documents
|
||||||
|
released under this License, and replace the individual copies of this
|
||||||
|
License in the various documents with a single copy that is included in
|
||||||
|
the collection, provided that you follow the rules of this License for
|
||||||
|
verbatim copying of each of the documents in all other respects.
|
||||||
|
|
||||||
|
You may extract a single document from such a collection, and distribute
|
||||||
|
it individually under this License, provided you insert a copy of this
|
||||||
|
License into the extracted document, and follow this License in all
|
||||||
|
other respects regarding verbatim copying of that document.
|
||||||
|
|
||||||
|
|
||||||
|
7. AGGREGATION WITH INDEPENDENT WORKS
|
||||||
|
|
||||||
|
A compilation of the Document or its derivatives with other separate
|
||||||
|
and independent documents or works, in or on a volume of a storage or
|
||||||
|
distribution medium, does not as a whole count as a Modified Version
|
||||||
|
of the Document, provided no compilation copyright is claimed for the
|
||||||
|
compilation. Such a compilation is called an "aggregate", and this
|
||||||
|
License does not apply to the other self-contained works thus compiled
|
||||||
|
with the Document, on account of their being thus compiled, if they
|
||||||
|
are not themselves derivative works of the Document.
|
||||||
|
|
||||||
|
If the Cover Text requirement of section 3 is applicable to these
|
||||||
|
copies of the Document, then if the Document is less than one quarter
|
||||||
|
of the entire aggregate, the Document's Cover Texts may be placed on
|
||||||
|
covers that surround only the Document within the aggregate.
|
||||||
|
Otherwise they must appear on covers around the whole aggregate.
|
||||||
|
|
||||||
|
|
||||||
|
8. TRANSLATION
|
||||||
|
|
||||||
|
Translation is considered a kind of modification, so you may
|
||||||
|
distribute translations of the Document under the terms of section 4.
|
||||||
|
Replacing Invariant Sections with translations requires special
|
||||||
|
permission from their copyright holders, but you may include
|
||||||
|
translations of some or all Invariant Sections in addition to the
|
||||||
|
original versions of these Invariant Sections. You may include a
|
||||||
|
translation of this License provided that you also include the
|
||||||
|
original English version of this License. In case of a disagreement
|
||||||
|
between the translation and the original English version of this
|
||||||
|
License, the original English version will prevail.
|
||||||
|
|
||||||
|
|
||||||
|
9. TERMINATION
|
||||||
|
|
||||||
|
You may not copy, modify, sublicense, or distribute the Document except
|
||||||
|
as expressly provided for under this License. Any other attempt to
|
||||||
|
copy, modify, sublicense or distribute the Document is void, and will
|
||||||
|
automatically terminate your rights under this License. However,
|
||||||
|
parties who have received copies, or rights, from you under this
|
||||||
|
License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
|
||||||
|
10. FUTURE REVISIONS OF THIS LICENSE
|
||||||
|
|
||||||
|
The Free Software Foundation may publish new, revised versions
|
||||||
|
of the GNU Free Documentation 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. See
|
||||||
|
http://www.gnu.org/copyleft/.
|
||||||
|
|
||||||
|
Each version of the License is given a distinguishing version number.
|
||||||
|
If the Document specifies that a particular numbered version of this
|
||||||
|
License "or any later version" applies to it, you have the option of
|
||||||
|
following the terms and conditions either of that specified version or
|
||||||
|
of any later version that has been published (not as a draft) by the
|
||||||
|
Free Software Foundation. If the Document does not specify a version
|
||||||
|
number of this License, you may choose any version ever published (not
|
||||||
|
as a draft) by the Free Software Foundation.
|
||||||
|
|
||||||
|
|
||||||
|
ADDENDUM: How to use this License for your documents
|
||||||
|
|
||||||
|
To use this License in a document you have written, include a copy of
|
||||||
|
the License in the document and put the following copyright and
|
||||||
|
license notices just after the title page:
|
||||||
|
|
||||||
|
Copyright (c) YEAR YOUR NAME.
|
||||||
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
|
under the terms of the GNU Free Documentation License, Version 1.1
|
||||||
|
or any later version published by the Free Software Foundation;
|
||||||
|
with the Invariant Sections being LIST THEIR TITLES, with the
|
||||||
|
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
|
||||||
|
A copy of the license is included in the section entitled "GNU
|
||||||
|
Free Documentation License".
|
||||||
|
|
||||||
|
If you have no Invariant Sections, write "with no Invariant Sections"
|
||||||
|
instead of saying which ones are invariant. If you have no
|
||||||
|
Front-Cover Texts, write "no Front-Cover Texts" instead of
|
||||||
|
"Front-Cover Texts being LIST"; likewise for Back-Cover Texts.
|
||||||
|
|
||||||
|
If your document contains nontrivial examples of program code, we
|
||||||
|
recommend releasing these examples in parallel under your choice of
|
||||||
|
free software license, such as the GNU General Public License,
|
||||||
|
to permit their use in free software.
|
340
GNU-GPL.txt
Normal file
340
GNU-GPL.txt
Normal file
@ -0,0 +1,340 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) 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
|
||||||
|
this service 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 make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. 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.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
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
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the 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 a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE 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.
|
||||||
|
|
||||||
|
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
|
||||||
|
convey 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 2 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, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision 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, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This 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 Library General
|
||||||
|
Public License instead of this License.
|
52
ReadMe.txt
Normal file
52
ReadMe.txt
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# $RCSfile: ReadMe.txt,v $
|
||||||
|
# $Revision: 1.1 $
|
||||||
|
# $Name: $
|
||||||
|
# $Date: 2008/11/12 02:25:22 $
|
||||||
|
# $Author: agibert $
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Welcome to IMR (Interlinking Message Router) !
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
This program is DIAMIS Cristal message transformer. It can convert XML Cristal messages to old flat message format and vice versa.
|
||||||
|
Thanks to its fully configurability, IMR can virtually convert any file format.
|
||||||
|
Message are read from and writen to different media: file, MQSeries ans Tuxedo Queues.
|
||||||
|
|
||||||
|
This is the initial and origianal release of IMR.
|
||||||
|
This version has been in production between April 2005 and February 2008 and no bug has been detected !
|
||||||
|
|
||||||
|
|
||||||
|
This release of IMR supports the following OS:
|
||||||
|
- Mandriva Linux 2005 (Developement),
|
||||||
|
- HP UX (Production).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Authors:
|
||||||
|
- Architecture and team leading : A. Gibert
|
||||||
|
- Conception, Development and Tests: A. Gibert, H. Moussaid, D. Olivon, E. Renaud (Coignet)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IMR is now licensed under the GPL GNU Licenses.
|
||||||
|
For more information, please read the corresponding source file headers.
|
||||||
|
The license details can be found in the GNU-GPL.txt and GNU-FDL.txt files.
|
||||||
|
|
||||||
|
IMR depend on:
|
||||||
|
- libnode V2.1.0-1 (http://www.rx3.org/dvp/?dvp=libnode),
|
||||||
|
- libxml2 V2.6.9 (http://www.xmlsoft.org/),
|
||||||
|
- libz V1.1.4 ((C) 1995-2002 Jean-loup Gailly and Mark Adler).
|
||||||
|
These libraries are currently distributed with IMR. Please check their corresponding licenses.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Enjoy it!
|
||||||
|
|
||||||
|
Your IMR Team.
|
||||||
|
|
||||||
|
arnaud@rx3.net
|
||||||
|
http://www.rx3.org/dvp/?dvp=imr
|
17
ReleaseNotes.txt
Normal file
17
ReleaseNotes.txt
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# $RCSfile: ReleaseNotes.txt,v $
|
||||||
|
# $Revision: 1.1 $
|
||||||
|
# $Name: $
|
||||||
|
# $Date: 2008/11/12 02:25:22 $
|
||||||
|
# $Author: agibert $
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
IMR V 1.0.0-1 - A. Gibert / H. Moussaid / D. Olivon / E. Renaud (Coignet) - 01/04/05
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
- Intial Version, released for MICOT/Target project (Banque de France - Paris),
|
||||||
|
- This version has been in production between April 2005 and February 2008.
|
||||||
|
- GPL Release.
|
12
ToDo.txt
Normal file
12
ToDo.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# $RCSfile: ToDo.txt,v $
|
||||||
|
# $Revision: 1.1 $
|
||||||
|
# $Name: $
|
||||||
|
# $Date: 2008/11/12 02:25:22 $
|
||||||
|
# $Author: agibert $
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- Remove libnode and libxml from source and use them externally,
|
||||||
|
- Support the forth comming libnode in order to support C99 standards...
|
BIN
doc/IMR-Architecture_Generale.odp
Normal file
BIN
doc/IMR-Architecture_Generale.odp
Normal file
Binary file not shown.
BIN
doc/IMR-Architecture_Generale.odt
Normal file
BIN
doc/IMR-Architecture_Generale.odt
Normal file
Binary file not shown.
BIN
doc/IMR-DCT-Mapping_Manager.odt
Normal file
BIN
doc/IMR-DCT-Mapping_Manager.odt
Normal file
Binary file not shown.
BIN
doc/IMR-DCT-Static_Data_Manager.odt
Normal file
BIN
doc/IMR-DCT-Static_Data_Manager.odt
Normal file
Binary file not shown.
BIN
doc/IMR-MCD.pdf
Executable file
BIN
doc/IMR-MCD.pdf
Executable file
Binary file not shown.
BIN
doc/IMR-MPD.pdf
Executable file
BIN
doc/IMR-MPD.pdf
Executable file
Binary file not shown.
179
src/Makefile
Normal file
179
src/Makefile
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# General Makefile
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Author: agibert $
|
||||||
|
# $Date: 2008/11/12 02:25:22 $
|
||||||
|
# $Revision: 1.1 $
|
||||||
|
# $Label: $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Makefile Target: clean all install uninstall clean-lib clean-bin
|
||||||
|
# lib bin install-lib install-bin uninstall-lib
|
||||||
|
# uninstall-bin
|
||||||
|
# Default Makefile Target: all
|
||||||
|
# Makefile Support Switches: ORACLE_SUPPORT TUX_SUPPORT MQS_SUPPORT
|
||||||
|
# Makefile Switches: VERBOSE WARNING DEBUG OPTIMIZE STATIC DYNAMIC
|
||||||
|
# Makefile Switches: PROFILE STRIP DOTI DOLINT EFENCE DMALLOC PURIFY
|
||||||
|
# Default Makefile Switches: STATIC=1 DEBUG=1
|
||||||
|
# Makefile Variables: CC SUBDIR
|
||||||
|
# Default Makefile Variables: SQLCHECK=FULL
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# IMR - Interlinking Message Router
|
||||||
|
# Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt)
|
||||||
|
# mailto:arnaud@rx3.net
|
||||||
|
# http://www.rx3.org/dvp/?dvp=imr
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# This file is part of IMR
|
||||||
|
#
|
||||||
|
# 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 2
|
||||||
|
# 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, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Constants
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
MAKE = make
|
||||||
|
SHELL = bash
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Variables
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
ifdef VERBOSE
|
||||||
|
QUIET=
|
||||||
|
SILENT=
|
||||||
|
else
|
||||||
|
QUIET=@
|
||||||
|
SILENT=-s
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LIB= libz \
|
||||||
|
libnode \
|
||||||
|
libxml \
|
||||||
|
liblog_mng \
|
||||||
|
libstatic_data_mng \
|
||||||
|
libio_mng \
|
||||||
|
libmapping_mng \
|
||||||
|
libmsg_router \
|
||||||
|
sd_appl_struct \
|
||||||
|
sd_cnv_struct \
|
||||||
|
sd_fmtattr_struct \
|
||||||
|
sd_fmt_struct \
|
||||||
|
sd_mappath_struct \
|
||||||
|
sd_msg_struct \
|
||||||
|
sd_msgmap_struct
|
||||||
|
|
||||||
|
BIN= imrd \
|
||||||
|
# imrc
|
||||||
|
|
||||||
|
SUBDIR= $(LIB) $(BIN)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# External targets
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
all:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
clean all install uninstall:
|
||||||
|
$(QUIET)$(MAKE) $(SILENT) $(MAKEOVERRIDES) make-$@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
lib:
|
||||||
|
$(QUIET)$(MAKE) $(SILENT) SUBDIR="$(LIB)" $(MAKEOVERRIDES) all
|
||||||
|
|
||||||
|
bin:
|
||||||
|
$(QUIET)$(MAKE) $(SILENT) SUBDIR="$(BIN)" $(MAKEOVERRIDES) all
|
||||||
|
|
||||||
|
clean-lib install-lib uninstall-lib:
|
||||||
|
$(QUIET)$(MAKE) $(SILENT) SUBDIR="$(LIB)" $(MAKEOVERRIDES) $(patsubst %-lib, %, $@)
|
||||||
|
|
||||||
|
clean-bin install-bin uninstall-bin:
|
||||||
|
$(QUIET)$(MAKE) $(SILENT) SUBDIR="$(BIN)" $(MAKEOVERRIDES) $(patsubst %-bin, %, $@)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Internal targets
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
make-clean make-all make-install make-uninstall: $(SUBDIR)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Rules
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(SUBDIR):
|
||||||
|
@echo Making $(patsubst make-%, %, $(MAKECMDGOALS)) into $@...
|
||||||
|
$(QUIET)$(MAKE) $(SILENT) -C $@/src ECHO_HEAD="\t$@: " $(MAKEOVERRIDES) $(patsubst make-%, %, $(MAKECMDGOALS))
|
||||||
|
@echo Completed $(patsubst make-%, %, $(MAKECMDGOALS)) into $@ !
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Suffixes
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.PHONY: clean clean-lib clean-bin make-clean all make-all lib bin install install-lib install-bin make-install uninstall uninstall-lib uninstall-bin make-uninstall $(SUBDIR)
|
||||||
|
ifdef PURIFY
|
||||||
|
.NOTPARALLEL:
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Dependencies
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(BIN): $(LIB)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ifneq (,$(findstring clean,$(MAKECMDGOALS)))
|
||||||
|
all: clean
|
||||||
|
install: clean
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(findstring uninstall,$(MAKECMDGOALS)))
|
||||||
|
all: uninstall
|
||||||
|
install: uninstall
|
||||||
|
endif
|
280
src/Makefile_rule.mk
Normal file
280
src/Makefile_rule.mk
Normal file
@ -0,0 +1,280 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Makefile Rule Definitions
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Author: agibert $
|
||||||
|
# $Date: 2008/11/12 02:25:22 $
|
||||||
|
# $Revision: 1.1 $
|
||||||
|
# $Label: $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Makefile Target: clean all dep install uninstall
|
||||||
|
# Default Makefile Target: all
|
||||||
|
# Makefile Support Switches: ORACLE_SUPPORT TUX_SUPPORT MQS_SUPPORT
|
||||||
|
# Makefile Switches: VERBOSE WARNING DEBUG OPTIMIZE STATIC DYNAMIC
|
||||||
|
# Makefile Switches: PROFILE STRIP DOTI DOLINT EFENCE DMALLOC PURIFY
|
||||||
|
# Default Makefile Switches: STATIC=1 DEBUG=1
|
||||||
|
# Makefile Variables: CC SQLCHECK
|
||||||
|
# Default Makefile Variables: SQLCHECK=FULL
|
||||||
|
# Tuxedo Server Tag: TXSERVICE_NAME TXSERVICE_TYPE
|
||||||
|
# Tuxedo Service Type: NONE TX_SERVER_OXA TX_CLIENT_ORA
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# IMR - Interlinking Message Router
|
||||||
|
# Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt)
|
||||||
|
# mailto:arnaud@rx3.net
|
||||||
|
# http://www.rx3.org/dvp/?dvp=imr
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# This file is part of IMR
|
||||||
|
#
|
||||||
|
# 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 2
|
||||||
|
# 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, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Variables
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
TARGET_FILES= $(TARGET)
|
||||||
|
INSTALL_FILES= $(TARGET)
|
||||||
|
UNINSTALL_FILES= $(TARGET)
|
||||||
|
|
||||||
|
ifeq ($(suffix $(TARGET)),$(SHLIB_SUFFIX))
|
||||||
|
INSTALL_DIR= $(GLOBAL_LIB_DIR)
|
||||||
|
TARGET_FILES+= $(TARGET:$(SHLIB_SUFFIX)=.a)
|
||||||
|
INSTALL_FILES+= $(TARGET:$(SHLIB_SUFFIX)=.a)
|
||||||
|
UNINSTALL_FILES+= $(TARGET:$(SHLIB_SUFFIX)=.a) .pure $(TARGET:$(SHLIB_SUFFIX)=_pure_*$(SHLIB_SUFFIX)) $(TARGET:$(SHLIB_SUFFIX)=_pure_*.a)
|
||||||
|
|
||||||
|
ifdef DOLINT
|
||||||
|
LINT_TARGET= llib-l$(subst lib,,$(basename $(TARGET))).ln
|
||||||
|
LINT_LIB= $(LINT_TARGET)
|
||||||
|
TARGET_FILES+= $(LINT_TARGET)
|
||||||
|
INSTALL_FILES+= $(LINT_TARGET)
|
||||||
|
UNINSTALL_FILES+= $(LINT_TARGET)
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifeq ($(suffix $(TARGET)),.xml)
|
||||||
|
INSTALL_DIR= $(GLOBAL_LIB_DIR)/imr
|
||||||
|
else
|
||||||
|
INSTALL_DIR= $(GLOBAL_BIN_DIR)
|
||||||
|
|
||||||
|
ifdef DOLINT
|
||||||
|
LINT_FILE= $(basename $(TARGET)).lint
|
||||||
|
LINT_LIB=
|
||||||
|
TARGET_FILES+= $(LINT_FILE)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef DOTI
|
||||||
|
TARGET_FILES+= $(OBJ:.o=.i)
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# External targets
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
all: dep
|
||||||
|
$(QUIET)$(MAKE) $(SILENT) $(MAKEOVERRIDES) build
|
||||||
|
|
||||||
|
clean:
|
||||||
|
@echo -e '$(ECHO_HEAD)Cleaning up...'
|
||||||
|
$(QUIET)$(RM) -f \
|
||||||
|
$(shell for file in $(OBJ:.o=); \
|
||||||
|
do \
|
||||||
|
if [ -f $$file.pc ]; \
|
||||||
|
then \
|
||||||
|
echo $$file.c $$file.lis; \
|
||||||
|
fi; \
|
||||||
|
done) \
|
||||||
|
$(OBJ:.o=.dep) \
|
||||||
|
$(OBJ:.o=.i) \
|
||||||
|
$(OBJ:.o=.ln) \
|
||||||
|
$(OBJ:.o=.sublint) \
|
||||||
|
$(OBJ:.o=_pure_*) \
|
||||||
|
$(OBJ) \
|
||||||
|
$(TARGET_FILES) \
|
||||||
|
llib-l$(subst lib,,$(basename $(TARGET))).ln \
|
||||||
|
llib-l$(subst lib,,$(basename $(TARGET))).sublint \
|
||||||
|
BS-*.c BS-*.o \
|
||||||
|
BS-*_pure_* \
|
||||||
|
BC-*.c BC-*.o \
|
||||||
|
BC-*_pure_* \
|
||||||
|
logfile* \
|
||||||
|
.pure
|
||||||
|
|
||||||
|
install: $(patsubst %,$(INSTALL_DIR)/%,$(INSTALL_FILES))
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
$(QUIET)for file in $(UNINSTALL_FILES); \
|
||||||
|
do \
|
||||||
|
echo -e "$(ECHO_HEAD)Uninstalling $$file from $(INSTALL_DIR)..."; \
|
||||||
|
$(RM) -f $(INSTALL_DIR)/$$file; \
|
||||||
|
done
|
||||||
|
|
||||||
|
dep:
|
||||||
|
$(QUIET)$(MAKE) $(SILENT) $(MAKEOVERRIDES) depend
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Internal targets
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
depend: $(OBJ:.o=.dep)
|
||||||
|
|
||||||
|
build: $(TARGET_FILES)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Rules
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
%.dep : %.c
|
||||||
|
@echo -e '$(ECHO_HEAD)Dependencing $<...'
|
||||||
|
$(QUIET)$(MAKEDEP) $(MAKEDEP_FLAGS) -o.o $< >$@
|
||||||
|
$(QUIET)$(MAKEDEP) $(MAKEDEP_FLAGS) -o.i $< >>$@
|
||||||
|
|
||||||
|
%.c : %.pc
|
||||||
|
@echo -e '$(ECHO_HEAD)Procing $<...'
|
||||||
|
$(QUIET)$(PROC) $(DEVNULL) $(PROC_FLAGS) oname=$@ iname=$< $(PROC_FILTER)
|
||||||
|
|
||||||
|
%.i : %.c
|
||||||
|
@echo -e '$(ECHO_HEAD)Precompilling $<...'
|
||||||
|
$(QUIET)$(CPP) $(CPPFLAGS) $(INCLUDE) -o $@ $<
|
||||||
|
|
||||||
|
%.ln : %.c
|
||||||
|
@echo -e '$(ECHO_HEAD)Linting $<...'
|
||||||
|
$(QUIET)$(LINT) $(LINTFLAGS) $(INCLUDE) -c > $(<:.c=.sublint) $<
|
||||||
|
|
||||||
|
%.o : %.c
|
||||||
|
@echo -e '$(ECHO_HEAD)Compilling $<...'
|
||||||
|
$(QUIET)$(CC) $(CFLAGS) $(INCLUDE) -o $@ $<
|
||||||
|
|
||||||
|
$(LINT_LIB): $(OBJ:.o=.ln)
|
||||||
|
@echo -e '$(ECHO_HEAD)Lib Linting $@...'
|
||||||
|
$(QUIET)$(LINT) $(LINTFLAGS) -o $(subst lib,,$(basename $(TARGET))) > $(@:.ln=.sublint) $(OBJ:.o=.ln)
|
||||||
|
|
||||||
|
%$(SHLIB_SUFFIX): %.o
|
||||||
|
@echo -e '$(ECHO_HEAD)Linking $@...'
|
||||||
|
$(QUIET)$(LD) $(LDFLAGS) -o $@ $(OBJ)
|
||||||
|
|
||||||
|
%.a : %.o
|
||||||
|
@echo -e '$(ECHO_HEAD)Linking $@...'
|
||||||
|
$(QUIET)$(AR) $(ARFLAGS) $@ $(OBJ)
|
||||||
|
|
||||||
|
%.lint : %.ln
|
||||||
|
@echo -e '$(ECHO_HEAD)Link Linting $@...'
|
||||||
|
$(QUIET)$(LINT) $(LINTFLAGS) $(LINTLIBS) $< >$@
|
||||||
|
|
||||||
|
% : %.o
|
||||||
|
ifeq ($(TXSERVICE_TYPE),TX_SERVER_OXA)
|
||||||
|
@echo -e '$(ECHO_HEAD)Building Tuxedo server $@... '
|
||||||
|
$(QUIET)$(PRELINK) $(TXBLDSRV) $(TXBLD_FLAGS) -o $@ -f "$(OBJ)" $(TXBLD_LIB) -s "$(TXSERVICE_NAME)" $(PRELINK_FILTER)
|
||||||
|
else
|
||||||
|
ifeq ($(TXSERVICE_TYPE),TX_CLIENT_ORA)
|
||||||
|
@echo -e '$(ECHO_HEAD)Building Tuxedo client $@...'
|
||||||
|
$(QUIET)$(PRELINK) $(TXBLDCLN) $(TXBLD_FLAGS) -o $@ -f "$(OBJ)" $(TXBLD_LIB) $(PRELINK_FILTER)
|
||||||
|
ifndef DEBUG
|
||||||
|
$(QUIET)$(RM) BC-*.c
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
@echo -e '$(ECHO_HEAD)Linking $@...'
|
||||||
|
ifdef PURIFY
|
||||||
|
@echo -e '$(ECHO_HEAD)Purifing $@... '
|
||||||
|
$(PURIFIER) $(PURIFIER_FLAGS) $(CC) $(LINK_FLAGS) -o $@ $(OBJ) $(LIB) $(PRELINK_FILTER)
|
||||||
|
else
|
||||||
|
$(QUIET)$(CC) $(LINK_FLAGS) -o $@ $(OBJ) $(LIB)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
ifdef DEBUG
|
||||||
|
ifeq ($(OS),HP-UX)
|
||||||
|
@echo -e '$(ECHO_HEAD)Pxdbing $@...'
|
||||||
|
$(QUIET)$(PXDB) $(PXDBFLAGS) $@
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
ifdef STRIP
|
||||||
|
@echo -e '$(ECHO_HEAD)Striping $@...'
|
||||||
|
$(QUIET)$(STRIPPER) $@
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
%.xml : %.xml.m4
|
||||||
|
@echo -e '$(ECHO_HEAD)M4ing $@... '
|
||||||
|
$(QUIET)$(M4) $(M4_FLAGS) > $@ $<
|
||||||
|
|
||||||
|
$(INSTALL_DIR)/%: $(INSTALL_DIR) all
|
||||||
|
@echo -e '$(ECHO_HEAD)Installing $(subst $(INSTALL_DIR)/,,$@) into $(INSTALL_DIR)...'
|
||||||
|
$(QUIET)$(CP) $(subst $(INSTALL_DIR)/,,$@) $(INSTALL_DIR)
|
||||||
|
|
||||||
|
$(INSTALL_DIR):
|
||||||
|
@echo -e '$(ECHO_HEAD)Creatinging $(INSTALL_DIR)...'
|
||||||
|
$(QUIET)$(MKDIR) $(INSTALL_DIR)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Suffixes
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
.SECONDARY: $(OBJ:.o=.c) $(OBJ:.o=.dep) $(OBJ:.o=.ln) $(OBJ:.o=.sublint)
|
||||||
|
.SUFFIXES: .pc .c .h .dep .i .ln .sublint .o $(SHLIB_SUFFIX) .a .lint
|
||||||
|
.PHONY: clean all dep install uninstall build depend
|
||||||
|
.DELETE_ON_ERROR:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Dependencies
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
$(OBJ): Makefile $(MAKEFILE_GLOB) $(MAKEFILE_PATH)
|
||||||
|
$(TARGET_FILES): $(OBJ) $(OBJ_RAW) Makefile $(MAKEFILE_GLOB) $(MAKEFILE_PATH)
|
||||||
|
|
||||||
|
ifneq ($(suffix $(TARGET)),$(SHLIB_SUFFIX))
|
||||||
|
ifneq ($(suffix $(TARGET)),.xml)
|
||||||
|
$(TARGET): $(patsubst %,$(GLOBAL_LIB_DIR)/lib%$(SHLIB_SUFFIX),$(LIB_LIST))
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(findstring clean,$(MAKECMDGOALS)))
|
||||||
|
dep: clean
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(findstring uninstall,$(MAKECMDGOALS)))
|
||||||
|
dep: uninstall
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(MAKECMDGOALS),build)
|
||||||
|
ifneq (,$(OBJ))
|
||||||
|
-include $(OBJ:.o=.dep)
|
||||||
|
endif
|
||||||
|
endif
|
65
src/Makefile_template.mk
Normal file
65
src/Makefile_template.mk
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Local Makefile
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Author: agibert $
|
||||||
|
# $Date: 2008/11/12 02:25:22 $
|
||||||
|
# $Revision: 1.1 $
|
||||||
|
# $Label: $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# IMR - Interlinking Message Router
|
||||||
|
# Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt)
|
||||||
|
# mailto:arnaud@rx3.net
|
||||||
|
# http://www.rx3.org/dvp/?dvp=imr
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# This file is part of IMR
|
||||||
|
#
|
||||||
|
# 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 2
|
||||||
|
# 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, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Var include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include ../../Makefile_var.mk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Variables
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
TARGET= lib_xxx$(SHLIB_SUFFIX)
|
||||||
|
|
||||||
|
OBJ= module1.o \
|
||||||
|
module2.o \
|
||||||
|
lib_xxx.o
|
||||||
|
|
||||||
|
EXTRA_INC= ../zzz
|
||||||
|
|
||||||
|
EXTRA_LIB= -lzzz
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Rule include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include ../../Makefile_rule.mk
|
497
src/Makefile_var.mk
Normal file
497
src/Makefile_var.mk
Normal file
@ -0,0 +1,497 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Makefile Var Definitions
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Author: agibert $
|
||||||
|
# $Date: 2008/11/12 02:25:22 $
|
||||||
|
# $Revision: 1.1 $
|
||||||
|
# $Label: $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# IMR - Interlinking Message Router
|
||||||
|
# Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt)
|
||||||
|
# mailto:arnaud@rx3.net
|
||||||
|
# http://www.rx3.org/dvp/?dvp=imr
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# This file is part of IMR
|
||||||
|
#
|
||||||
|
# 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 2
|
||||||
|
# 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, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Curent Module Dir
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
LOCAL_INC_DIR= ../include
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Global Dir
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
GLOBAL_INC_DIR= ../../include
|
||||||
|
GLOBAL_BIN_DIR= ../../../bin
|
||||||
|
GLOBAL_LIB_DIR= ../../../lib
|
||||||
|
|
||||||
|
LIB_LIST= msg_router mapping_mng io_mng static_data_mng log_mng xml node z
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Constants
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
MAKE = make
|
||||||
|
MAKEDEP = makedepend
|
||||||
|
SHELL = bash
|
||||||
|
RM = rm
|
||||||
|
MKDIR = mkdir -p
|
||||||
|
CP = cp
|
||||||
|
CAT = cat
|
||||||
|
M4 = m4
|
||||||
|
PROC = proc
|
||||||
|
CC =
|
||||||
|
#CC = cc
|
||||||
|
#CC = gcc
|
||||||
|
CPP = $(CC)
|
||||||
|
LD =
|
||||||
|
#LD = ld
|
||||||
|
#LD = $(CC)
|
||||||
|
AR = ar
|
||||||
|
TXBLDSRV = buildserver
|
||||||
|
TXBLDCLN = buildclient
|
||||||
|
TXMKFML = mkfldhdr
|
||||||
|
TXMKVIEW = viewc
|
||||||
|
PXDB = pxdb
|
||||||
|
LINT = lint
|
||||||
|
STRIPPER = strip
|
||||||
|
PURIFIER = purify
|
||||||
|
|
||||||
|
COMMA = ,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Variables
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
OS = $(shell uname)
|
||||||
|
|
||||||
|
ifndef CC
|
||||||
|
ifeq ($(OS),HP-UX)
|
||||||
|
CC= cc
|
||||||
|
LD= ld
|
||||||
|
else
|
||||||
|
CC= gcc
|
||||||
|
LD= gcc
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef VERBOSE
|
||||||
|
QUIET=
|
||||||
|
SILENT=
|
||||||
|
PROC_FILTER=
|
||||||
|
PRELINK_FILTER=
|
||||||
|
TXBLDSRV+= -v
|
||||||
|
TXBLDCLN+= -v
|
||||||
|
else
|
||||||
|
QUIET=@
|
||||||
|
SILENT=-s
|
||||||
|
PROC_FILTER=| grep -v -e '^$$' -e '^Pro' -e '^(c)' \
|
||||||
|
-e '^Copyright' -e '^System default option'; \
|
||||||
|
[[ $${PIPESTATUS[0]} = 0 ]]
|
||||||
|
PRELINK_FILTER=2>&1 | grep -v -e '^Purify' \
|
||||||
|
-e '^Instrumenting: '; \
|
||||||
|
[[ $${PIPESTATUS[0]} = 0 ]]
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef DYNAMIC
|
||||||
|
STATIC=
|
||||||
|
else
|
||||||
|
STATIC=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef OPTIMIZE
|
||||||
|
DEBUG=
|
||||||
|
else
|
||||||
|
DEBUG=1
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef DEBUG
|
||||||
|
TXBLDSRV+= -k
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef SQLCHECK
|
||||||
|
SQLCHECK=FULL
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef ORACLE_SUPPORT
|
||||||
|
ifndef ORACLE_HOME
|
||||||
|
ORACLE_SUPPORT = 0
|
||||||
|
else
|
||||||
|
ORACLE_SUPPORT = 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef TUX_SUPPORT
|
||||||
|
ifndef TUXDIR
|
||||||
|
TUX_SUPPORT = 0
|
||||||
|
else
|
||||||
|
TUX_SUPPORT = 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifndef MQS_SUPPORT
|
||||||
|
ifndef MQM_HOME
|
||||||
|
MQS_SUPPORT = 0
|
||||||
|
else
|
||||||
|
MQS_SUPPORT = 1
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Flags Init
|
||||||
|
INCLUDE=
|
||||||
|
LIB_cc=
|
||||||
|
LIB_gcc=
|
||||||
|
LIB=
|
||||||
|
M4_FLAGS=
|
||||||
|
MAKEDEP_FLAGS=
|
||||||
|
PROC_FLAGS=
|
||||||
|
CPPFLAGS=
|
||||||
|
CPPFLAGS_cc=
|
||||||
|
CPPFLAGS_gcc=
|
||||||
|
CFLAGS=
|
||||||
|
CFLAGS_cc=
|
||||||
|
CFLAGS_gcc=
|
||||||
|
LDFLAGS=
|
||||||
|
TXBLD_FLAGS=
|
||||||
|
TXBLD_FLAGS_cc=
|
||||||
|
TXBLD_FLAGS_gcc=
|
||||||
|
LDFLAGS=
|
||||||
|
LDFLAGS_cc=
|
||||||
|
LDFLAGS_gcc=
|
||||||
|
LINK_FLAGS=
|
||||||
|
LINK_FLAGS_cc=
|
||||||
|
LINK_FLAGS_gcc=
|
||||||
|
ARFLAGS=
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PURIFIER_FLAGS= -user-path=$(shell echo "$(patsubst %,lib%/src,$(LIB_LIST)) imrd/src" | sed 's/ /\:/g')
|
||||||
|
|
||||||
|
ifdef PURIFY
|
||||||
|
PRELINK=echo -e '$(ECHO_HEAD)Purifing $@... '; \
|
||||||
|
export CC="$(PURIFIER) $(PURIFIER_FLAGS) $(CC)";
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ifeq ($(ORACLE_SUPPORT),1)
|
||||||
|
INCLUDE+= -I$(ORACLE_HOME)/precomp/public
|
||||||
|
LIB+= -L$(ORACLE_HOME)/lib -lclntsh
|
||||||
|
M4_FLAGS+= -DORACLE_SUPPORT
|
||||||
|
MAKEDEP_FLAGS+= -DORACLE_SUPPORT
|
||||||
|
PROC_FLAGS+= DEFINE=ORACLE_SUPPORT
|
||||||
|
CPPFLAGS+= -DORACLE_SUPPORT
|
||||||
|
CFLAGS+= -DORACLE_SUPPORT
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(TUX_SUPPORT),1)
|
||||||
|
INCLUDE+= -I$(TUXDIR)/include
|
||||||
|
LIB+= -L$(TUXDIR)/lib -lfml -lfml32 -ltux
|
||||||
|
M4_FLAGS+= -DTUX_SUPPORT
|
||||||
|
MAKEDEP_FLAGS+= -DTUX_SUPPORT
|
||||||
|
PROC_FLAGS+= DEFINE=TUX_SUPPORT
|
||||||
|
CPPFLAGS+= -DTUX_SUPPORT
|
||||||
|
CFLAGS+= -DTUX_SUPPORT
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(MQS_SUPPORT),1)
|
||||||
|
INCLUDE+= -I$(MQM_HOME)/inc
|
||||||
|
LIB+= -L$(MQM_HOME)/lib64 -lmqic
|
||||||
|
M4_FLAGS+= -DMQS_SUPPORT
|
||||||
|
MAKEDEP_FLAGS+= -DMQS_SUPPORT
|
||||||
|
PROC_FLAGS+= DEFINE=MQS_SUPPORT
|
||||||
|
CPPFLAGS+= -DMQS_SUPPORT
|
||||||
|
CFLAGS+= -DMQS_SUPPORT
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# OS Dependant Flags
|
||||||
|
|
||||||
|
ifeq ($(OS),HP-UX)
|
||||||
|
SHLIB_SUFFIX= .sl
|
||||||
|
M4_FLAGS:= -B100000 -S100000 $(M4_FLAGS)
|
||||||
|
MAKEDEP_FLAGS+= -z -D _HPUX_SOURCE -D __hpux
|
||||||
|
PROC_FLAGS+= DEFINE=_PA_RISC2_0
|
||||||
|
CPPFLAGS+= -D _HPUX_SOURCE -D __hpux
|
||||||
|
CFLAGS+= -D _HPUX_SOURCE -D __hpux
|
||||||
|
LDFLAGS+= -b
|
||||||
|
LDFLAGS+=
|
||||||
|
|
||||||
|
ifeq ($(ARCH),32BITS)
|
||||||
|
MAKEDEP_FLAGS+=
|
||||||
|
CPPFLAGS_cc+= +DD32
|
||||||
|
CPPFLAGS_gcc+=
|
||||||
|
CFLAGS_cc+= +DD32
|
||||||
|
CFLAGS_gcc+=
|
||||||
|
TXBLD_FLAGS_cc+= +DD32
|
||||||
|
TXBLD_FLAGS_gcc+=
|
||||||
|
LINK_FLAGS_cc+= +DD32
|
||||||
|
LINK_FLAGS_gcc+=
|
||||||
|
LDFLAGS_cc+=
|
||||||
|
LDFLAGS_gcc+=
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(ARCH),64BITS)
|
||||||
|
MAKEDEP_FLAGS+= -D__LP64__
|
||||||
|
CPPFLAGS_cc+= +DD64
|
||||||
|
CPPFLAGS_gcc+=
|
||||||
|
CFLAGS_cc+= +DD64
|
||||||
|
CFLAGS_gcc+=
|
||||||
|
TXBLD_FLAGS_cc+= +DD64
|
||||||
|
TXBLD_FLAGS_gcc+=
|
||||||
|
LINK_FLAGS_cc+= +DD64
|
||||||
|
LINK_FLAGS_gcc+=
|
||||||
|
LDFLAGS_cc+=
|
||||||
|
LDFLAGS_gcc+=
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
SHLIB_SUFFIX= .so
|
||||||
|
M4_FLAGS+=
|
||||||
|
MAKEDEP_FLAGS+=
|
||||||
|
PROC_FLAGS+=
|
||||||
|
CPPFLAGS+=
|
||||||
|
CFLAGS+=
|
||||||
|
LDFLAGS+= -shared
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Compiler Dependant Flags
|
||||||
|
|
||||||
|
INCLUDE+= -I. \
|
||||||
|
$(patsubst %,-I../../lib%/include,$(LIB_LIST)) \
|
||||||
|
-I$(GLOBAL_INC_DIR) \
|
||||||
|
$(shell for inc in $(EXTRA_INC); \
|
||||||
|
do \
|
||||||
|
echo "-I$$inc "; \
|
||||||
|
done)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ifeq ($(SQLCHECK),FULL)
|
||||||
|
PROC_FLAGS+= USERID=$(USR_IMRMGR)/$(PWD_IMRMGR)
|
||||||
|
endif
|
||||||
|
|
||||||
|
PROC_FLAGS+= SQLCHECK=$(SQLCHECK) \
|
||||||
|
RELEASE_CURSOR=NO \
|
||||||
|
HOLD_CURSOR=YES \
|
||||||
|
MAXOPENCURSOR=100 \
|
||||||
|
DBMS=V7 \
|
||||||
|
MODE=ORACLE \
|
||||||
|
CODE=ANSI_C \
|
||||||
|
$(patsubst -I%,INCLUDE=%,$(INCLUDE))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CPPFLAGS_cc+= -P -C -Ae -w
|
||||||
|
CPPFLAGS_gcc+= -E -C
|
||||||
|
|
||||||
|
CFLAGS_cc+= -c -Ae +z
|
||||||
|
CFLAGS_gcc+= -c -fpic -pipe
|
||||||
|
|
||||||
|
TXBLD_FLAGS_cc+= -Wl,+s,-Bimmediate
|
||||||
|
TXBLD_FLAGS_gcc+=
|
||||||
|
|
||||||
|
LDFLAGS_cc+=
|
||||||
|
LDFLAGS_gcc+=
|
||||||
|
|
||||||
|
LINK_FLAGS_cc+=
|
||||||
|
LINK_FLAGS_gcc+=
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ifdef DEBUG
|
||||||
|
CFLAGS_cc+= -g
|
||||||
|
CFLAGS_gcc+= -g
|
||||||
|
TXBLD_FLAGS_cc+= -g
|
||||||
|
TXBLD_FLAGS_gcc+= -g
|
||||||
|
LDFLAGS_cc+=
|
||||||
|
LDFLAGS_gcc+=
|
||||||
|
LINK_FLAGS_cc+= -g
|
||||||
|
LINK_FLAGS_gcc+= -g
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef OPTIMIZE
|
||||||
|
CFLAGS_cc+= -O
|
||||||
|
CFLAGS_gcc+= -O3
|
||||||
|
TXBLD_FLAGS_cc+= -O
|
||||||
|
TXBLD_FLAGS_gcc+= -O3
|
||||||
|
LDFLAGS_cc+=
|
||||||
|
LDFLAGS_gcc+= -O3
|
||||||
|
LINK_FLAGS_cc+= -O
|
||||||
|
LINK_FLAGS_gcc+= -Wl,-O3
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef PROFILE
|
||||||
|
CFLAGS_cc+= -pg
|
||||||
|
CFLAGS_gcc+= -pg
|
||||||
|
TXBLD_FLAGS_cc+= -pg
|
||||||
|
TXBLD_FLAGS_gcc+= -pg
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ifdef WARNING
|
||||||
|
CFLAGS_cc+=+w1 +M2
|
||||||
|
CFLAGS_gcc+=-Wformat -Wnonnull -Wimplicit -Wmain -Wmissing-braces \
|
||||||
|
-Wparentheses -Wsequence-point -Wreturn-type -Wswitch \
|
||||||
|
-Wswitch-default -Wswitch-enum -Wtrigraphs -Wunused \
|
||||||
|
-Wuninitialized -Wunknown-pragmas -Wstrict-aliasing -W \
|
||||||
|
-Wfloat-equal -Wundef -Wendif-labels -Wshadow \
|
||||||
|
-Wpointer-arith -Wbad-function-cast -Wcast-qual \
|
||||||
|
-Wcast-align -Wwrite-strings -Wconversion \
|
||||||
|
-Wsign-compare -Waggregate-return -Wstrict-prototypes \
|
||||||
|
-Wmissing-prototypes -Wmissing-declarations \
|
||||||
|
-Wmissing-noreturn -Wmissing-format-attribute -Wpacked \
|
||||||
|
-Wredundant-decls -Wnested-externs -Wunreachable-code \
|
||||||
|
-Winline -Wlong-long -Wdisabled-optimization
|
||||||
|
TXBLD_FLAGS_cc+=+w1 +M2
|
||||||
|
TXBLD_FLAGS_gcc+=-Wformat -Wnonnull -Wimplicit -Wmain -Wmissing-braces \
|
||||||
|
-Wparentheses -Wsequence-point -Wreturn-type -Wswitch \
|
||||||
|
-Wswitch-default -Wswitch-enum -Wtrigraphs -Wunused \
|
||||||
|
-Wuninitialized -Wunknown-pragmas -Wstrict-aliasing -W \
|
||||||
|
-Wfloat-equal -Wundef -Wendif-labels -Wshadow \
|
||||||
|
-Wpointer-arith -Wbad-function-cast -Wcast-qual \
|
||||||
|
-Wcast-align -Wwrite-strings -Wconversion \
|
||||||
|
-Wsign-compare -Waggregate-return -Wstrict-prototypes \
|
||||||
|
-Wmissing-prototypes -Wmissing-declarations \
|
||||||
|
-Wmissing-noreturn -Wmissing-format-attribute -Wpacked \
|
||||||
|
-Wredundant-decls -Wnested-externs -Wunreachable-code \
|
||||||
|
-Winline -Wlong-long -Wdisabled-optimization
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ifdef EFENCE
|
||||||
|
else
|
||||||
|
ifdef DMALLOC
|
||||||
|
CFLAGS+= -DDMALLOC
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ifdef STATIC
|
||||||
|
ifeq ($(CC),cc)
|
||||||
|
LIB+= -Wl,-a,archive_shared
|
||||||
|
|
||||||
|
ifeq ($(ARCH),64BITS)
|
||||||
|
LIB+= -Wl,+forceload
|
||||||
|
else
|
||||||
|
LIB+= -Wl,-E
|
||||||
|
endif
|
||||||
|
else
|
||||||
|
LIB+= -Wl,-export-dynamic,-whole-archive,-Bstatic
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
LIB+= -L$(GLOBAL_LIB_DIR) \
|
||||||
|
$(patsubst %,-l%,$(LIB_LIST))
|
||||||
|
|
||||||
|
ifdef STATIC
|
||||||
|
ifeq ($(CC),cc)
|
||||||
|
ifeq ($(ARCH),64BITS)
|
||||||
|
LIB+= -Wl,+noforceload
|
||||||
|
endif
|
||||||
|
|
||||||
|
LIB+= -Wl,-a,shared_archive
|
||||||
|
else
|
||||||
|
LIB+= -Wl,-no-whole-archive,-Bdynamic
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifdef EFENCE
|
||||||
|
LIB+= -lefence -lrt
|
||||||
|
else
|
||||||
|
ifdef DMALLOC
|
||||||
|
LIB+= -ldmalloc
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
LIB_cc+= -lnsl -lm -lpthread
|
||||||
|
|
||||||
|
LIB_gcc+= -lpthread -lm -ldl
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TXBLD_LIB= -f "$(LIB) -ltmib"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
TXSERVICE_NAME= $(shell if [ -f $(TARGET).c ]; \
|
||||||
|
then \
|
||||||
|
grep TXSERVICE_NAME $(TARGET).c | \
|
||||||
|
sed "s/.*: //"; \
|
||||||
|
fi)
|
||||||
|
TXSERVICE_TYPE= $(shell if [ -f $(TARGET).c ]; \
|
||||||
|
then \
|
||||||
|
grep TXSERVICE_TYPE $(TARGET).c | \
|
||||||
|
sed "s/.*: //"; \
|
||||||
|
fi)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PXDBFLAGS= -s on $(EXTRA_PXDBFLAGS)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LINTFLAGS= $(EXTRA_LINTFLAGS)
|
||||||
|
|
||||||
|
LINTLIBS= $(GLOBAL_LIB_DIR)/*.ln
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Flags Merging
|
||||||
|
|
||||||
|
MAKEDEP_FLAGS+= $(INCLUDE) -f- $(EXTRA_MAKEDEP_FLAGS)
|
||||||
|
PROC_FLAGS+= $(EXTRA_PROC_FLAGS)
|
||||||
|
CPPFLAGS+= $(CPPFLAGS_$(CPP)) $(EXTRA_CPPFLAGS)
|
||||||
|
CFLAGS+= $(CFLAGS_$(CC)) $(EXTRA_CFLAGS)
|
||||||
|
LINK_FLAGS+= $(LINK_FLAGS_$(CC)) $(EXTRA_LINK_FLAGS)
|
||||||
|
LDFLAGS+= $(LDFLAGS_$(CC)) $(EXTRA_LDFLAGS)
|
||||||
|
LIB+= $(LIB_$(CC)) $(EXTRA_LIB)
|
||||||
|
ARFLAGS+= -cr $(EXTRA_ARFLAGS)
|
||||||
|
TXBLD_FLAGS+= -f "$(TXBLD_FLAGS_$(CC))" -r $(ORACLE_RM) $(EXTRA_TXBLD_FLAGS)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ifeq ($(CC),gcc)
|
||||||
|
TXBLDSRV:=CC=cc.gcc; $(TXBLDSRV)
|
||||||
|
TXBLDCLN:=CC=cc.gcc; $(TXBLDCLN)
|
||||||
|
endif
|
59
src/imrc/src/Makefile
Normal file
59
src/imrc/src/Makefile
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Local Makefile
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# IMR - Interlinking Message Router
|
||||||
|
# Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt)
|
||||||
|
# mailto:arnaud@rx3.net
|
||||||
|
# http://www.rx3.org/dvp/?dvp=imr
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# This file is part of IMR
|
||||||
|
#
|
||||||
|
# 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 2
|
||||||
|
# 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, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Constants
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
MAKEFILE_GLOB= ../../Makefile_glob.mk
|
||||||
|
MAKEFILE_PATH= ../../Makefile_path.mk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Variables
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
TARGET= lib_xxx.sl
|
||||||
|
|
||||||
|
OBJ= module1.o \
|
||||||
|
module2.o \
|
||||||
|
lib_xxx.o
|
||||||
|
|
||||||
|
EXTRA_INC= ../zzz
|
||||||
|
|
||||||
|
EXTRA_LIB= -lzzz
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include $(MAKEFILE_GLOB)
|
65
src/imrd/src/Makefile
Normal file
65
src/imrd/src/Makefile
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Local Makefile
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Workfile: Makefile $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Author: agibert $
|
||||||
|
# $Date: 2008/11/12 02:25:22 $
|
||||||
|
# $Revision: 1.1 $
|
||||||
|
# $Label: $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# IMR - Interlinking Message Router
|
||||||
|
# Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt)
|
||||||
|
# mailto:arnaud@rx3.net
|
||||||
|
# http://www.rx3.org/dvp/?dvp=imr
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# This file is part of IMR
|
||||||
|
#
|
||||||
|
# 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 2
|
||||||
|
# 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, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Var include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include ../../Makefile_var.mk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Variables
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
TARGET= imrd
|
||||||
|
|
||||||
|
OBJ= imrd.o
|
||||||
|
|
||||||
|
EXTRA_INC=
|
||||||
|
|
||||||
|
EXTRA_LIB=
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Rule include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include ../../Makefile_rule.mk
|
1140
src/imrd/src/imrd.c
Normal file
1140
src/imrd/src/imrd.c
Normal file
File diff suppressed because it is too large
Load Diff
415
src/imrd/src/imrd.h
Normal file
415
src/imrd/src/imrd.h
Normal file
@ -0,0 +1,415 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: imrd.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _IMRD_H_
|
||||||
|
#define _IMRD_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <imr.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local Return Status */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Module Definitions */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_IMRD_MODULE_ID ( IMRT_Module_Id) 6
|
||||||
|
#define IMRD_IMRD_MODULE_NAME ( IMRT_Module_Name) "imrd"
|
||||||
|
#define IMRD_IMRD_MODULE_NAME_LONG ( IMRT_Module_Name_Long) "Interlinking Message Router Daemon"
|
||||||
|
#define IMRD_IMRD_MODULE_VERSION ( IMRT_Module_Version) "@(#) VERSIONIMR: $Label: $ $Date: 2008/11/12 02:25:22 $ $Workfile: imrd.h $"
|
||||||
|
|
||||||
|
#define IMRD_MODULE_PTR &IMRG_IMRD_Module
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local Definitions */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct IMRT_Module_Entry
|
||||||
|
{
|
||||||
|
IMRT_Module *Module_Ptr;
|
||||||
|
IMRT_Lib_Status Status;
|
||||||
|
IMRT_Lib_Config *Config_Ptr;
|
||||||
|
} IMRT_Module_Entry;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_IMRD_Config
|
||||||
|
{
|
||||||
|
IMRT_Medium_URL Medium_URL_Input, Medium_URL_Output, Medium_URL_Trash;
|
||||||
|
IMRT_Appl_Name Appl_Name_Input, Appl_Name_Output;
|
||||||
|
IMRT_Appl_Id Appl_Id_Input, Appl_Id_Output;
|
||||||
|
IMRT_Boolean Version_Mode, Help_Mode;
|
||||||
|
IMRT_SDM_Flag Dump_Mode;
|
||||||
|
IMRT_Boolean Core_Dump;
|
||||||
|
} IMRT_IMRD_Config;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Config
|
||||||
|
{
|
||||||
|
IMRT_LM_Config LM;
|
||||||
|
IMRT_SDM_Config SDM;
|
||||||
|
IMRT_IOM_Config IOM;
|
||||||
|
IMRT_MM_Config MM;
|
||||||
|
IMRT_MR_Config MR;
|
||||||
|
IMRT_IMRD_Config IMRD;
|
||||||
|
} IMRT_Config;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_MODULE_NB ( IMRT_Module_Id) 7
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_IMRD_Base
|
||||||
|
{
|
||||||
|
// IMRT_Module_Nb Module_Nb;
|
||||||
|
IMRT_Module_Entry Module_Entry_Tab[ IMRD_MODULE_NB];
|
||||||
|
IMRT_Config Config;
|
||||||
|
int Sig_Trapped;
|
||||||
|
sigjmp_buf SigLongJmp_Env;
|
||||||
|
struct sigaction OAct_Int, OAct_Quit, OAct_Term, OAct_Bus, OAct_SegV;
|
||||||
|
|
||||||
|
} IMRT_IMRD_Base;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Module IMRG_IMRD_Module =
|
||||||
|
{
|
||||||
|
IMRD_IMRD_MODULE_ID,
|
||||||
|
IMRD_IMRD_MODULE_NAME,
|
||||||
|
IMRD_IMRD_MODULE_NAME_LONG,
|
||||||
|
IMRD_IMRD_MODULE_VERSION,
|
||||||
|
IMRD_MODULE_TYPE_OBJECT,
|
||||||
|
{
|
||||||
|
IMRD_LIB_STATUS_UNKNOWN,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_IMRD_Base IMRG_IMRD_Base =
|
||||||
|
{
|
||||||
|
// IMRD_LIB_NB,
|
||||||
|
{
|
||||||
|
{ NULL, IMRD_LIB_STATUS_UNKNOWN, NULL},
|
||||||
|
{ &IMRG_LM_Module, IMRD_LIB_STATUS_CLOSED, (IMRT_Lib_Config *) &( IMRG_IMRD_Base.Config.LM)},
|
||||||
|
{ &IMRG_SDM_Module, IMRD_LIB_STATUS_CLOSED, (IMRT_Lib_Config *) &( IMRG_IMRD_Base.Config.SDM)},
|
||||||
|
{ &IMRG_IOM_Module, IMRD_LIB_STATUS_CLOSED, (IMRT_Lib_Config *) &( IMRG_IMRD_Base.Config.IOM)},
|
||||||
|
{ &IMRG_MM_Module, IMRD_LIB_STATUS_CLOSED, (IMRT_Lib_Config *) &( IMRG_IMRD_Base.Config.MM)},
|
||||||
|
{ &IMRG_MR_Module, IMRD_LIB_STATUS_CLOSED, (IMRT_Lib_Config *) &( IMRG_IMRD_Base.Config.MR)},
|
||||||
|
{ &IMRG_IMRD_Module, IMRD_LIB_STATUS_UNKNOWN, (IMRT_Lib_Config *) &( IMRG_IMRD_Base.Config.IMRD)}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{ "", 0, { 0 } },
|
||||||
|
{ IMRD_SDM_FLAG_UNKNOWN, ""},
|
||||||
|
{ NULL},
|
||||||
|
{ IMRD_FALSE},
|
||||||
|
{ IMRD_FALSE, IMRD_READ_MODE_WAIT},
|
||||||
|
{ "", "", "", "", "", 0, 0, IMRD_FALSE, IMRD_FALSE, IMRD_SDM_FLAG_UNKNOWN, IMRD_FALSE}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Base IMRG_Base =
|
||||||
|
{
|
||||||
|
0,
|
||||||
|
{0}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_ARG_NAME_LEN ( short) 63
|
||||||
|
#define IMRD_ARG_NAME_SIZE ( short) (IMRD_ARG_NAME_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Arg_Name[ IMRD_ARG_NAME_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_ARG_HELP_LEN ( short) 128
|
||||||
|
#define IMRD_ARG_HELP_SIZE ( short) 128
|
||||||
|
|
||||||
|
typedef char IMRT_Arg_Help[ IMRD_ARG_HELP_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_ARG_ID;
|
||||||
|
|
||||||
|
#define IMRD_ARG_NB ( IMRT_ARG_ID) 25
|
||||||
|
|
||||||
|
#define IMRD_ARG_UNKNOWN ( IMRT_ARG_ID) 0
|
||||||
|
#define IMRD_ARG_VERSION ( IMRT_ARG_ID) 1
|
||||||
|
#define IMRD_ARG_HELP ( IMRT_ARG_ID) 2
|
||||||
|
#define IMRD_ARG_VERBOSE_LEVEL_DEFAULT ( IMRT_ARG_ID) 3
|
||||||
|
#define IMRD_ARG_VERBOSE_LEVEL_MODULE ( IMRT_ARG_ID) 4
|
||||||
|
#define IMRD_ARG_LOG_FILE ( IMRT_ARG_ID) 5
|
||||||
|
#define IMRD_ARG_SD_READ_XML ( IMRT_ARG_ID) 6
|
||||||
|
#define IMRD_ARG_SD_READ_SQL ( IMRT_ARG_ID) 7
|
||||||
|
#define IMRD_ARG_SD_WRITE_XML ( IMRT_ARG_ID) 8
|
||||||
|
#define IMRD_ARG_SD_WRITE_SQL ( IMRT_ARG_ID) 9
|
||||||
|
#define IMRD_ARG_LIBRARY_DIR ( IMRT_ARG_ID) 10
|
||||||
|
#define IMRD_ARG_MEDIUM_URL_INPUT ( IMRT_ARG_ID) 11
|
||||||
|
#define IMRD_ARG_MEDIUM_URL_OUTPUT ( IMRT_ARG_ID) 12
|
||||||
|
#define IMRD_ARG_MEDIUM_URL_TRASH ( IMRT_ARG_ID) 13
|
||||||
|
#define IMRD_ARG_APPL_NAME_INPUT ( IMRT_ARG_ID) 14
|
||||||
|
#define IMRD_ARG_APPL_NAME_OUTPUT ( IMRT_ARG_ID) 15
|
||||||
|
#define IMRD_ARG_APPL_ID_INPUT ( IMRT_ARG_ID) 16
|
||||||
|
#define IMRD_ARG_APPL_ID_OUTPUT ( IMRT_ARG_ID) 17
|
||||||
|
#define IMRD_ARG_MAPPING_FORCED ( IMRT_ARG_ID) 18
|
||||||
|
#define IMRD_ARG_CONTINUE_FORCED ( IMRT_ARG_ID) 19
|
||||||
|
#define IMRD_ARG_NO_WAIT ( IMRT_ARG_ID) 20
|
||||||
|
#define IMRD_ARG_XML_FORMAT ( IMRT_ARG_ID) 21
|
||||||
|
#define IMRD_ARG_CORE_DUMP ( IMRT_ARG_ID) 22
|
||||||
|
#define IMRD_ARG_LOG_ID_INPUT_MSG ( IMRT_ARG_ID) 23
|
||||||
|
#define IMRD_ARG_LOG_ID_OUTPUT_MSG ( IMRT_ARG_ID) 24
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Arg
|
||||||
|
{
|
||||||
|
IMRT_Arg_Name Name_Short;
|
||||||
|
IMRT_Arg_Name Name_Long;
|
||||||
|
IMRT_Arg_Help Help;
|
||||||
|
} IMRT_Arg;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Arg IMRG_Arg_Tab[ IMRD_ARG_NB] =
|
||||||
|
{
|
||||||
|
{ "", "", "Unknown"},
|
||||||
|
{ "-V", "--version", "Print version"},
|
||||||
|
{ "-h", "--help", "Print this help"},
|
||||||
|
{ "-vld", "--verbose_level_default", "Set the genral verbose level"},
|
||||||
|
{ "-vlm", "--verbose_level_module", "Set the module verbose level"},
|
||||||
|
{ "-lf", "--log_file", "Set log file"},
|
||||||
|
#ifdef ORACLE_SUPPORT
|
||||||
|
{ "-sdrx", "--static_data_read_xml", "Read static data from xml repository"},
|
||||||
|
{ "-sdrs", "--static_data_read_sql", "Read static data from sql repository"},
|
||||||
|
{ "-sdwx", "--static_data_write_xml", "Write static data to xml repository"},
|
||||||
|
{ "-sdws", "--static_data_write_sql", "Write static data to sql repository"},
|
||||||
|
#else
|
||||||
|
{ "", "", "None"},
|
||||||
|
{ "", "", "None"},
|
||||||
|
{ "", "", "None"},
|
||||||
|
{ "", "", "None"},
|
||||||
|
#endif /* ORACLE_SUPPORT */
|
||||||
|
{ "-ld", "--library_dir", "Set imr library dir"},
|
||||||
|
{ "-mui", "--medium_url_input", "Set input medium url"},
|
||||||
|
{ "-muo", "--medium_url_output", "Set output medium url"},
|
||||||
|
{ "-mut", "--medium_url_trash", "Set trash medium url"},
|
||||||
|
{ "-ani", "--appl_name_input", "Set input appl name"},
|
||||||
|
{ "-ano", "--appl_name_output", "Set output appl name"},
|
||||||
|
{ "-aii", "--appl_id_input", "Set input appl id"},
|
||||||
|
{ "-aio", "--appl_id_output", "Set output appl id"},
|
||||||
|
{ "-mf", "--mapping_forced", "Output bad mapped buffer"},
|
||||||
|
{ "-cf", "--continue_forced", "Continue on mapping error"},
|
||||||
|
{ "-nw", "--no_wait", "Don't wait if nothing to read"},
|
||||||
|
{ "-xf", "--xml_format", "Format xml output buffer"},
|
||||||
|
{ "-cd", "--core_dump", "Dump core on SIGSEGV and SIGBUS"},
|
||||||
|
{ "-iim", "--id_input_message", "Log Id input message"},
|
||||||
|
{ "-iom", "--id_output_message", "Log Id output message"}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Config_Init */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Config_Ptr: Config structure to initialize */
|
||||||
|
/* ArgC: Argument number */
|
||||||
|
/* ArgV: Argument tab */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Config_Init( IMRT_Config *, int, char **);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Config_Deinit */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Config_Ptr: Config structure to deinitialize */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Config_Deinit( IMRT_Config *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Args_Parse */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Config_Ptr: Configuration structure to update */
|
||||||
|
/* ArgC: Argument number */
|
||||||
|
/* ArgV: Argument tab */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Args_Parse( IMRT_Config *, int, char **);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Args_Log */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Config_Ptr: Configuration structure to dump */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Args_Log( IMRT_Config *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Version_Log */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Version_Log( void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Version_Print */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Version_Print( void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Help_Print */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Help_Print( void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Lib_Open */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Module_Entry_Ptr: Module to open */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Lib_Open( IMRT_Module_Entry *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Libs_Open */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Module_Entry_Tab: Module tab */
|
||||||
|
/* Module_Nb: Number of module */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Libs_Open( IMRT_Module_Entry *, IMRT_Module_Id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Lib_Close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Module_Entry_Ptr: Module to close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Lib_Close( IMRT_Module_Entry *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Libs_Close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Module_Entry_Tab: Module tab */
|
||||||
|
/* Module_Nb: Number of module */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Libs_Close( IMRT_Module_Entry *, IMRT_Module_Id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Signal_Trap */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void Signal_Trap( int);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Signal_Init */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Signal_Init();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* main */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* ArgC: argument number */
|
||||||
|
/* ArgV: Argument tab */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
int main( int, char **);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
702
src/include/imr.h
Normal file
702
src/include/imr.h
Normal file
@ -0,0 +1,702 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: imr.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _IMR_H_
|
||||||
|
#define _IMR_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include <libgen.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
|
||||||
|
#include <node.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define TRACE 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global definitions */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef short IMRT_Boolean;
|
||||||
|
|
||||||
|
#define IMRD_FALSE ( IMRT_Boolean) 0
|
||||||
|
#define IMRD_TRUE ( IMRT_Boolean) 1
|
||||||
|
|
||||||
|
#define IMRD_NO 'n'
|
||||||
|
#define IMRD_YES 'y'
|
||||||
|
|
||||||
|
#define IMRD_MAX(A,B) (((A) < (B)) ? (B) : (A))
|
||||||
|
#define IMRD_MIN(A,B) (((A) > (B)) ? (B) : (A))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Status definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef short IMRT_Status;
|
||||||
|
|
||||||
|
#define IMRS_OK ( IMRT_Status) 0
|
||||||
|
|
||||||
|
#define IMRS_KO ( IMRT_Status) 1
|
||||||
|
#define IMRS_NO_IDENT ( IMRT_Status) -2
|
||||||
|
#define IMRS_BAD_FORMAT ( IMRT_Status) -3
|
||||||
|
#define IMRS_ROLLBACK ( IMRT_Status) -4
|
||||||
|
|
||||||
|
#define IMRS_NO_DATA ( IMRT_Status) 3
|
||||||
|
#define IMRS_SIGNAL ( IMRT_Status) 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Module and Lib definitions */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef short IMRT_Module_Id;
|
||||||
|
|
||||||
|
#define IMRD_MODULE_ID_UNKNOWN (IMRT_Module_Id) 0
|
||||||
|
|
||||||
|
#define IMRD_MODULE_NB_MAX (IMRT_Module_Id) 10
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef char *IMRT_Module_Name;
|
||||||
|
|
||||||
|
|
||||||
|
typedef char *IMRT_Module_Name_Long;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef char *IMRT_Module_Version;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_Module_Type;
|
||||||
|
|
||||||
|
#define IMRD_MODULE_TYPE_UNKNOWN ( IMRT_Module_Type) 0
|
||||||
|
#define IMRD_MODULE_TYPE_OBJECT ( IMRT_Module_Type) 1
|
||||||
|
#define IMRD_MODULE_TYPE_LIBRARY ( IMRT_Module_Type) 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_Lib_Status;
|
||||||
|
|
||||||
|
#define IMRD_LIB_STATUS_UNKNOWN ( IMRT_Lib_Status) 0
|
||||||
|
#define IMRD_LIB_STATUS_CLOSED ( IMRT_Lib_Status) 1
|
||||||
|
#define IMRD_LIB_STATUS_OPENED ( IMRT_Lib_Status) 2
|
||||||
|
#define IMRD_LIB_STATUS_ERROR ( IMRT_Lib_Status) 3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Lib_Config
|
||||||
|
{
|
||||||
|
char *dummy;
|
||||||
|
} IMRT_Lib_Config;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef IMRT_Status ( IMRT_Lib_Open)( IMRT_Lib_Config *);
|
||||||
|
typedef IMRT_Status ( IMRT_Lib_Close)( void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Lib
|
||||||
|
{
|
||||||
|
IMRT_Lib_Status Status;
|
||||||
|
IMRT_Lib_Open *Open_Ptr;
|
||||||
|
IMRT_Lib_Close *Close_Ptr;
|
||||||
|
} IMRT_Lib;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Module
|
||||||
|
{
|
||||||
|
IMRT_Module_Id Id;
|
||||||
|
IMRT_Module_Name Name;
|
||||||
|
IMRT_Module_Name_Long Name_Long;
|
||||||
|
IMRT_Module_Version Version;
|
||||||
|
IMRT_Module_Type Type;
|
||||||
|
IMRT_Lib Lib;
|
||||||
|
} IMRT_Module;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Path definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_PATH_LEN ( short) 255
|
||||||
|
#define IMRD_PATH_SIZE ( short) ( IMRD_PATH_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Path[ IMRD_PATH_SIZE];
|
||||||
|
|
||||||
|
typedef short IMRT_Lib_Flag;
|
||||||
|
#define IRMD_LIB_FLAG_SDM_XML (IMRT_Lib_Flag)0
|
||||||
|
#define IRMD_LIB_FLAG_SDM_SQL (IMRT_Lib_Flag)1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Tag definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_TAG_LEN ( short) 100
|
||||||
|
#define IMRD_TAG_SIZE ( short) ( IMRD_TAG_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Tag[ IMRD_TAG_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Cnv_Id definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef short IMRT_Cnv_Id;
|
||||||
|
|
||||||
|
#define IMRD_CNV_ID_UNKNOWN ( IMRT_Cnv_Id) 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Cnv_Name definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_CNV_NAME_LEN ( short) 65
|
||||||
|
#define IMRD_CNV_NAME_SIZE ( short) ( IMRD_CNV_NAME_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Cnv_Name[ IMRD_CNV_NAME_SIZE];
|
||||||
|
|
||||||
|
#define IMRD_CNV_NAME_UNKNOWN "Unknown"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Cnv_Attr definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_CNV_ATTR_LEN ( short) 20
|
||||||
|
#define IMRD_CNV_ATTR_SIZE ( short) ( IMRD_CNV_ATTR_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Cnv_Attr[ IMRD_CNV_ATTR_SIZE];
|
||||||
|
|
||||||
|
#define IMRD_CNV_ATTR_UNKNOWN "UNKNOWN"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Cnv definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct IMRT_Cnv
|
||||||
|
{
|
||||||
|
IMRT_Cnv_Id Id;
|
||||||
|
IMRT_Cnv_Name Name;
|
||||||
|
} IMRT_Cnv;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Field definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_FIXED_SIZE_UNKNOWN ( size_t) -1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_NAME_LEN ( short) 255
|
||||||
|
#define IMRD_NAME_SIZE ( short) ( IMRD_NAME_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Field_Name[ IMRD_NAME_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_VALUE_ID_LEN ( short) 20
|
||||||
|
#define IMRD_VALUE_ID_SIZE ( short) ( IMRD_VALUE_ID_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Field_Value_Id[ IMRD_VALUE_ID_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_EXIST_LEN ( short) 1
|
||||||
|
#define IMRD_EXIST_SIZE ( short) ( IMRD_EXIST_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Field_Exist[ IMRD_EXIST_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_VALUE_LEN ( short) 150
|
||||||
|
#define IMRD_VALUE_SIZE ( short) ( IMRD_VALUE_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Value[ IMRD_VALUE_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Field_Fixed
|
||||||
|
{
|
||||||
|
size_t Offset;
|
||||||
|
size_t Size;
|
||||||
|
IMRT_Value Def_Val;
|
||||||
|
IMRT_Cnv *Cnv_Ptr;
|
||||||
|
IMRT_Cnv_Attr Cnv_Attr;
|
||||||
|
} IMRT_Field_Fixed;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_FML_TAG_LEN ( short) 50
|
||||||
|
#define IMRD_FML_TAG_SIZE ( short) ( IMRD_FML_TAG_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_FML_Tag[ IMRD_FML_TAG_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_FML_TAG_UNKNOWN ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Field_FML
|
||||||
|
{
|
||||||
|
IMRT_FML_Tag Tag;
|
||||||
|
IMRT_Value Def_Val;
|
||||||
|
IMRT_Cnv *Cnv_Ptr;
|
||||||
|
IMRT_Cnv_Attr Cnv_Attr;
|
||||||
|
} IMRT_Field_FML;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_XML_TAG_LEN ( short) 150
|
||||||
|
#define IMRD_XML_TAG_SIZE ( short) ( IMRD_XML_TAG_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_XML_Tag[ IMRD_XML_TAG_SIZE];
|
||||||
|
|
||||||
|
#define IMRD_XML_TAG_UNKNOWN ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Field_XML
|
||||||
|
{
|
||||||
|
IMRT_XML_Tag Tag;
|
||||||
|
IMRT_Value Def_Val;
|
||||||
|
IMRT_Cnv *Cnv_Ptr;
|
||||||
|
IMRT_Cnv_Attr Cnv_Attr;
|
||||||
|
} IMRT_Field_XML;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_TAGGED_TAG_LEN ( short) 20
|
||||||
|
#define IMRD_TAGGED_TAG_SIZE ( short) ( IMRD_TAGGED_TAG_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Tagged_Tag[ IMRD_TAGGED_TAG_SIZE];
|
||||||
|
|
||||||
|
#define IMRD_TAGGED_TAG_UNKNOWN ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Field_Tagged
|
||||||
|
{
|
||||||
|
IMRT_Tagged_Tag Tag;
|
||||||
|
IMRT_Value Def_Val;
|
||||||
|
IMRT_Cnv *Cnv_Ptr;
|
||||||
|
IMRT_Cnv_Attr Cnv_Attr;
|
||||||
|
} IMRT_Field_Tagged;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_INTERNAL_TAG_LEN ( short) 20
|
||||||
|
#define IMRD_INTERNAL_TAG_SIZE ( short) ( IMRD_INTERNAL_TAG_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Internal_Tag[ IMRD_INTERNAL_TAG_SIZE];
|
||||||
|
|
||||||
|
#define IMRD_INTERNAL_TAG_UNKNOWN ""
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Field_Internal
|
||||||
|
{
|
||||||
|
IMRT_Internal_Tag Tag;
|
||||||
|
IMRT_Value Def_Val;
|
||||||
|
IMRT_Cnv *Cnv_Ptr;
|
||||||
|
IMRT_Cnv_Attr Cnv_Attr;
|
||||||
|
} IMRT_Field_Internal;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_Delimited_Id;
|
||||||
|
|
||||||
|
#define IMRD_DELIMITED_ID_UNKNOWN ( IMRT_Delimited_Id) -1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Field_Delimited
|
||||||
|
{
|
||||||
|
IMRT_Delimited_Id Id;
|
||||||
|
IMRT_Value Def_Val;
|
||||||
|
IMRT_Cnv *Cnv_Ptr;
|
||||||
|
IMRT_Cnv_Attr Cnv_Attr;
|
||||||
|
} IMRT_Field_Delimited;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Field_Id definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef int IMRT_Field_Id;
|
||||||
|
|
||||||
|
#define IMRD_FIELD_ID_UNKNOWN ( IMRT_Field_Id) 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Field
|
||||||
|
{
|
||||||
|
IMRT_Field_Id Id;
|
||||||
|
IMRT_Field_Name Name;
|
||||||
|
IMRT_Field_Value_Id Value_Id;
|
||||||
|
IMRT_Boolean Exist;
|
||||||
|
IMRT_Field_Fixed Fixed;
|
||||||
|
IMRT_Field_FML FML;
|
||||||
|
IMRT_Field_XML XML;
|
||||||
|
IMRT_Field_Tagged Tagged;
|
||||||
|
IMRT_Field_Internal Internal;
|
||||||
|
IMRT_Field_Delimited Delimited;
|
||||||
|
} IMRT_Field;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_FieldMap_Id definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef int IMRT_FieldMap_Id;
|
||||||
|
|
||||||
|
#define IMRD_FIELDMAP_ID_UNKNOWN ( IMRT_FieldMap_Id) 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_FieldMap definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct IMRT_FieldMap
|
||||||
|
{
|
||||||
|
IMRT_FieldMap_Id Id;
|
||||||
|
IMRT_Field *Field_Input_Ptr;
|
||||||
|
IMRT_Field *Field_Output_Ptr;
|
||||||
|
} IMRT_FieldMap;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Msg definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef short IMRT_Msg_Id;
|
||||||
|
|
||||||
|
#define IMRD_MSG_ID_UNKNOWN ( IMRT_Msg_Id ) 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef char IMRT_Msg_Name[ IMRD_NAME_SIZE];
|
||||||
|
|
||||||
|
#define IMRD_MSG_NAME_UNKNOWN "UNKNOWN"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Msg
|
||||||
|
{
|
||||||
|
IMRT_Msg_Id Id;
|
||||||
|
IMRT_Msg_Name Name;
|
||||||
|
size_t Size;
|
||||||
|
NDT_Root *Field_Struct_Ptr;
|
||||||
|
} IMRT_Msg;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Fmt definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* #define IMRT_LG_MESSAGE_TYPE 60 */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef int IMRT_Fmt_Id;
|
||||||
|
|
||||||
|
#define IMRD_FMT_ID_UNKNOWN ( IMRT_Fmt_Id) 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_FMT_NAME_LEN ( short) 20
|
||||||
|
#define IMRD_FMT_NAME_SIZE ( short) ( IMRD_FMT_NAME_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Fmt_Name[ IMRD_FMT_NAME_SIZE];
|
||||||
|
|
||||||
|
#define IMRD_FMT_NAME_UNKNOWN "Unknown"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_Branche_Id;
|
||||||
|
|
||||||
|
#define IMRD_BRANCHE_ID_UNKNOWN ( IMRT_Branche_Id ) 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_FmtAttr_Id;
|
||||||
|
|
||||||
|
#define IMRD_FMTATTR_ID_UNKNOWN ( IMRT_FmtAttr_Id) 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_FMTATTR_NAME_LEN ( short) 65
|
||||||
|
#define IMRD_FMTATTR_NAME_SIZE ( short) ( IMRD_FMTATTR_NAME_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_FmtAttr_Name[ IMRD_FMTATTR_NAME_SIZE];
|
||||||
|
|
||||||
|
#define IMRD_FMTATTR_NAME_UNKNOWN "unknown"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_FMTATTR_VALUE_LEN ( short) 20
|
||||||
|
#define IMRD_FMTATTR_VALUE_SIZE ( short) ( IMRD_FMTATTR_VALUE_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_FmtAttr_Value[ IMRD_FMTATTR_VALUE_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_FmtAttr definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct IMRT_FmtAttr
|
||||||
|
{
|
||||||
|
IMRT_FmtAttr_Id Id;
|
||||||
|
IMRT_FmtAttr_Name Name;
|
||||||
|
IMRT_FmtAttr_Value Value;
|
||||||
|
} IMRT_FmtAttr;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_FmtMsg definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct IMRT_FmtMsg
|
||||||
|
{
|
||||||
|
IMRT_Msg *Msg_Ptr;
|
||||||
|
IMRT_Branche_Id Branche_Id;
|
||||||
|
IMRT_FmtAttr *FmtAttr_Ptr;
|
||||||
|
} IMRT_FmtMsg;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Fmt
|
||||||
|
{
|
||||||
|
IMRT_Fmt_Id Id;
|
||||||
|
IMRT_Fmt_Name Name;
|
||||||
|
NDT_Root *FmtMsg_Struct_Ptr;
|
||||||
|
} IMRT_Fmt;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Appl_Id definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef short IMRT_Appl_Id;
|
||||||
|
|
||||||
|
#define IMRD_APPL_ID_UNKNOWN ( IMRT_Appl_Id) 0
|
||||||
|
|
||||||
|
#define IMRD_APPL_ID_UNDEFINEDED ( IMRT_Appl_Id) -1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Appl_Name definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_APPL_NAME_LEN ( short) 30
|
||||||
|
#define IMRD_APPL_NAME_SIZE ( short) ( IMRD_APPL_NAME_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Appl_Name[ IMRD_APPL_NAME_SIZE];
|
||||||
|
|
||||||
|
#define IMRD_APPL_NAME_UNKNOWN "UNKNOWN"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Buffer definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef short IMRT_Dir_Id;
|
||||||
|
|
||||||
|
#define IMRD_DIR_ID_UNKNOWN ( IMRT_Dir_Id) 0
|
||||||
|
#define IMRD_DIR_ID_IN ( IMRT_Dir_Id) 1
|
||||||
|
#define IMRD_DIR_ID_OUT ( IMRT_Dir_Id) 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_Buffer_Status;
|
||||||
|
|
||||||
|
#define IMRD_BUFFER_STATUS_UNKNOWN ( IMRT_Buffer_Status) 0
|
||||||
|
#define IMRD_BUFFER_STATUS_ALLOCATED ( IMRT_Buffer_Status) 1
|
||||||
|
#define IMRD_BUFFER_STATUS_FREED ( IMRT_Buffer_Status) 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_Buffer_Flag;
|
||||||
|
|
||||||
|
#define IMRD_BUFFER_FLAG_UNKNOWN ( IMRT_Buffer_Flag) 0
|
||||||
|
#define IMRD_BUFFER_FLAG_OPENED ( IMRT_Buffer_Flag) 1
|
||||||
|
#define IMRD_BUFFER_FLAG_CLOSED ( IMRT_Buffer_Flag) 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef char IMRT_Buffer_Data;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Buffer
|
||||||
|
{
|
||||||
|
IMRT_Msg_Id Msg_Id;
|
||||||
|
IMRT_Appl_Id Appl_Id_Input;
|
||||||
|
IMRT_Appl_Id Appl_Id_Output;
|
||||||
|
IMRT_Dir_Id Dir_Id;
|
||||||
|
IMRT_Fmt_Id Fmt_Id;
|
||||||
|
IMRT_FmtAttr_Value FmtAttr_Value;
|
||||||
|
IMRT_Buffer_Status Status;
|
||||||
|
IMRT_Buffer_Flag Flag;
|
||||||
|
size_t Data_Buf_Len;
|
||||||
|
size_t Data_Buf_Size;
|
||||||
|
IMRT_Buffer_Data *Data_Buf_Ptr;
|
||||||
|
IMRT_Boolean Data_Tmp_Changed;
|
||||||
|
IMRT_Buffer_Data *Data_Tmp_Ptr;
|
||||||
|
} IMRT_Buffer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_Buffer_Id;
|
||||||
|
|
||||||
|
#define IMRT_BUFFER_ID_MAX_NB ( IMRT_Buffer_Id) 50
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_IOM_Read_Mode definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef short IMRT_Read_Mode;
|
||||||
|
|
||||||
|
#define IMRD_READ_MODE_UNKNOWN ( IMRT_Read_Mode) 0
|
||||||
|
#define IMRD_READ_MODE_WAIT ( IMRT_Read_Mode) 1
|
||||||
|
#define IMRD_READ_MODE_NO_WAIT ( IMRT_Read_Mode) 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Base */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct IMRT_Base
|
||||||
|
{
|
||||||
|
int Sig_Trapped;
|
||||||
|
sigjmp_buf SigLongJmp_Env;
|
||||||
|
} IMRT_Base;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef _IMRD_C_
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
extern IMRT_Base IMRG_Base;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR libraries */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <log_mng.h>
|
||||||
|
#include <static_data_mng.h>
|
||||||
|
#include <io_mng.h>
|
||||||
|
#include <mapping_mng.h>
|
||||||
|
#include <msg_router.h>
|
||||||
|
|
||||||
|
#endif
|
459
src/libio_mng/include/io_mng.h
Normal file
459
src/libio_mng/include/io_mng.h
Normal file
@ -0,0 +1,459 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* $Workfile: io_mng.h $ */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* $Author: agibert $ */
|
||||||
|
/* $Date: 2008/11/12 02:25:22 $ */
|
||||||
|
/* $Revision: 1.1 $ */
|
||||||
|
/* $Label: $ */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _IO_MNG_H_
|
||||||
|
#define _IO_MNG_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <imr.h>
|
||||||
|
|
||||||
|
#ifdef TUX_SUPPORT
|
||||||
|
# include <atmi.h>
|
||||||
|
# include <fml32.h>
|
||||||
|
# include <tpadm.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MQS_SUPPORT
|
||||||
|
# include <cmqc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRD_IOM_API definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBIO_MNG_
|
||||||
|
# define IMRD_IOM_API
|
||||||
|
# else
|
||||||
|
# define IMRD_IOM_API extern
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IOM_Config definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct IMRT_IOM_Config
|
||||||
|
{
|
||||||
|
char *dummy;
|
||||||
|
|
||||||
|
} IMRT_IOM_Config;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_File_Delim definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_FILE_DELIM_LEN (short) 32
|
||||||
|
#define IMRD_FILE_DELIM_SIZE (short) ( IMRD_FILE_DELIM_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_File_Delim[ IMRD_FILE_DELIM_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_File_Buffer definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_FILE_BUFFER_LEN (size_t) 4096
|
||||||
|
#define IMRD_FILE_BUFFER_SIZE (size_t) ( IMRD_FILE_BUFFER_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_File_Buffer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Medium_File definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct IMRT_Medium_File
|
||||||
|
{
|
||||||
|
IMRT_File_Delim Delim;
|
||||||
|
size_t Delim_Len;
|
||||||
|
size_t Msg_Len;
|
||||||
|
IMRT_Path Path;
|
||||||
|
FILE *Handle_Ptr;
|
||||||
|
IMRT_File_Buffer *Buffer_Ptr;
|
||||||
|
size_t Buffer_Len;
|
||||||
|
IMRT_File_Buffer *Cur_Ptr;
|
||||||
|
|
||||||
|
} IMRT_Medium_File;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef TUX_SUPPORT
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Tux_Queue_Name definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_TUX_QUEUE_NAME_LEN ( short) 255
|
||||||
|
#define IMRD_TUX_QUEUE_NAME_SIZE ( short) ( IMRD_TUX_QUEUE_NAME_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Tux_Queue_Name[ IMRD_TUX_QUEUE_NAME_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Tux_Queue_Space definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_TUX_QUEUE_SPACE_LEN ( short) 255
|
||||||
|
#define IMRD_TUX_QUEUE_SPACE_SIZE ( short) ( IMRD_TUX_QUEUE_SPACE_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Tux_Queue_Space[ IMRD_TUX_QUEUE_SPACE_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Tux_Open_Info definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_TUX_OPEN_INFO_LEN ( short) 255
|
||||||
|
#define IMRD_TUX_OPEN_INFO_SIZE ( short) ( IMRD_TUX_OPEN_INFO_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Tux_Open_Info[ IMRD_TUX_OPEN_INFO_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Tux_Lmid definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_TUX_LMID_LEN ( short) 255
|
||||||
|
#define IMRD_TUX_LMID_SIZE ( short) ( IMRD_TUX_LMID_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Tux_Lmid[ IMRD_TUX_LMID_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_TUX_BUFFER_SIZE ( size_t) 10000
|
||||||
|
|
||||||
|
typedef FBFR32 IMRT_Tux_Buffer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Medium_Tux definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct IMRT_Medium_Tux
|
||||||
|
{
|
||||||
|
IMRT_Tux_Queue_Space Queue_Space;
|
||||||
|
IMRT_Tux_Queue_Name Queue_Name;
|
||||||
|
|
||||||
|
} IMRT_Medium_Tux;
|
||||||
|
#endif /* MQS_SUPPORT */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef MQS_SUPPORT
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_MQS_Queue_Manager definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_MQS_QUEUE_MNG_LEN ( short) 255
|
||||||
|
#define IMRD_MQS_QUEUE_MNG_SIZE ( short) ( IMRD_MQS_QUEUE_MNG_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_MQS_Queue_Mng[ IMRD_MQS_QUEUE_MNG_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_MQS_Queue_Name definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_MQS_QUEUE_NAME_LEN ( short) 255
|
||||||
|
#define IMRD_MQS_QUEUE_NAME_SIZE ( short) ( IMRD_MQS_QUEUE_NAME_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_MQS_Queue_Name[ IMRD_MQS_QUEUE_NAME_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_MQS_BUFFER_LEN (size_t) 4096
|
||||||
|
#define IMRD_MQS_BUFFER_SIZE (size_t) ( IMRD_MQS_BUFFER_LEN + 1)
|
||||||
|
|
||||||
|
typedef MQBYTE IMRT_MQS_Buffer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Mediul_MQS definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct IMRT_Medium_MQS
|
||||||
|
{
|
||||||
|
IMRT_MQS_Queue_Mng Queue_Mng;
|
||||||
|
IMRT_MQS_Queue_Name Queue_Name;
|
||||||
|
MQHCONN Conn_Hdl;
|
||||||
|
MQHOBJ Obj_Hdl;
|
||||||
|
|
||||||
|
} IMRT_Medium_MQS;
|
||||||
|
#endif /* MQS_SUPPORT */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Medium definitions */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_MEDIUM_NAME_LEN ( short) 64
|
||||||
|
#define IMRD_MEDIUM_NAME_SIZE ( short) ( IMRD_MEDIUM_NAME_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Medium_Name[ IMRD_MEDIUM_NAME_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_Medium_Type;
|
||||||
|
|
||||||
|
#define IMRD_MEDIUM_TYPE_UNKNOWN ( IMRT_Medium_Type) 0
|
||||||
|
#define IMRD_MEDIUM_TYPE_FILE ( IMRT_Medium_Type) 1
|
||||||
|
|
||||||
|
#ifdef MQS_SUPPORT
|
||||||
|
# define IMRD_MEDIUM_TYPE_TUX ( IMRT_Medium_Type) 2
|
||||||
|
#endif /* TUX_SUPPORT */
|
||||||
|
|
||||||
|
#ifdef MQS_SUPPORT
|
||||||
|
# define IMRD_MEDIUM_TYPE_MQS ( IMRT_Medium_Type) 3
|
||||||
|
#endif /* MQS_SUPPORT */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_Medium_Status;
|
||||||
|
|
||||||
|
#define IMRD_MEDIUM_STATUS_UNKNOWN ( IMRT_Medium_Status) 0
|
||||||
|
#define IMRD_MEDIUM_STATUS_OPENED ( IMRT_Medium_Status) 1
|
||||||
|
#define IMRD_MEDIUM_STATUS_CLOSED ( IMRT_Medium_Status) 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_MEDIUM_URL_LEN ( short) 255
|
||||||
|
#define IMRD_MEDIUM_URL_SIZE ( short) ( IMRD_MEDIUM_URL_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Medium_URL[ IMRD_MEDIUM_URL_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define IMRD_MEDIUM_PATH_LEN ( short) 255
|
||||||
|
#define IMRD_MEDIUM_PATH_SIZE ( short) ( IMRD_MEDIUM_PATH_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_Medium_Path[ IMRD_MEDIUM_PATH_SIZE];
|
||||||
|
|
||||||
|
typedef short IMRT_Medium_Tran_Flag;
|
||||||
|
|
||||||
|
#define IMRD_MEDIUM_TRAN_FLAG_UNKNOWN ( IMRT_Medium_Tran_Flag) 0
|
||||||
|
#define IMRD_MEDIUM_TRAN_FLAG_IN ( IMRT_Medium_Tran_Flag) 1
|
||||||
|
#define IMRD_MEDIUM_TRAN_FLAG_OUT ( IMRT_Medium_Tran_Flag) 2
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Medium
|
||||||
|
{
|
||||||
|
IMRT_Medium_Name Name;
|
||||||
|
IMRT_Medium_Type Type;
|
||||||
|
IMRT_Medium_Status Status;
|
||||||
|
IMRT_Medium_URL URL;
|
||||||
|
IMRT_Appl_Id Appl_Id_Input;
|
||||||
|
IMRT_Appl_Id Appl_Id_Output;
|
||||||
|
IMRT_Dir_Id Dir_Id;
|
||||||
|
IMRT_Medium_Tran_Flag Tran_Flag;
|
||||||
|
size_t Byte_Nb;
|
||||||
|
size_t Msg_Nb;
|
||||||
|
|
||||||
|
IMRT_Medium_File File;
|
||||||
|
|
||||||
|
#ifdef TUX_SUPPORT
|
||||||
|
IMRT_Medium_Tux Tux;
|
||||||
|
#endif /* TUX_SUPPORT */
|
||||||
|
|
||||||
|
#ifdef MQS_SUPPORT
|
||||||
|
IMRT_Medium_MQS MQS;
|
||||||
|
#endif /* MQS_SUPPORT */
|
||||||
|
|
||||||
|
} IMRT_Medium;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Tran definitions */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef int IMRT_Medium_Nb;
|
||||||
|
|
||||||
|
typedef struct IMRT_Tran
|
||||||
|
{
|
||||||
|
IMRT_Medium **Medium_Ptr_Tab;
|
||||||
|
IMRT_Medium_Nb Medium_Nb;
|
||||||
|
|
||||||
|
} IMRT_Tran;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBIO_MNG_
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
extern IMRT_Module IMRG_IOM_Module;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/*IO Manager API */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Open IO Manager */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IOM_Config_Ptr: Setup IOM init mode */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_IOM_API IMRT_Status IMR_IOM_Library_Open( IMRT_IOM_Config *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Close IO Manager */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_IOM_API IMRT_Status IMR_IOM_Library_Close( void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Open Medium */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr_Ptr: Reference to the Pointer to the opened medium */
|
||||||
|
/* Medium_Name: Name of the medium */
|
||||||
|
/* Medium_URL: Medium URL to open */
|
||||||
|
/* Appl_Id_Input: Input application Id link with the medium */
|
||||||
|
/* Appl_Id_Output: Output application Id link with the medium */
|
||||||
|
/* Dir_Id: Medium open direction */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_IOM_API IMRT_Status IMR_IOM_Medium_Open( IMRT_Medium **, IMRT_Medium_Name, IMRT_Medium_URL, IMRT_Appl_Id, IMRT_Appl_Id, IMRT_Dir_Id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Close Medium */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_IOM_API IMRT_Status IMR_IOM_Medium_Close( IMRT_Medium *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Read Medium */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer_Ptr: Pointer to the buffer to write */
|
||||||
|
/* Medium_Ptr: Pointer to the medium to read */
|
||||||
|
/* Read_Mode: Read mode */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_IOM_API IMRT_Status IMR_IOM_Medium_Read( IMRT_Buffer *, IMRT_Medium *, IMRT_Read_Mode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Write Medium */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to write */
|
||||||
|
/* Buffer_Ptr: Pointer to the buffer to read */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_IOM_API IMRT_Status IMR_IOM_Medium_Write( IMRT_Medium *, IMRT_Buffer *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Tran Begin */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Tran_Ptr_Ptr: Reference to the pointer of the transaction to begin */
|
||||||
|
/* Medium_Count: Number of medium to enclose into the transaction */
|
||||||
|
/* Medium_1_Ptr: Pointer to the first medium */
|
||||||
|
/* ... */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_IOM_API IMRT_Status IMR_IOM_Tran_Begin( IMRT_Tran **, IMRT_Medium_Nb, IMRT_Medium *, ...);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Tran Commit */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Tran_Ptr: Pointer to the transaction to commit */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_IOM_API IMRT_Status IMR_IOM_Tran_Commit( IMRT_Tran *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Tran Rollback */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Tran_Ptr: Pointer to the transaction to rollback */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_IOM_API IMRT_Status IMR_IOM_Tran_Rollback( IMRT_Tran *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
74
src/libio_mng/src/Makefile
Normal file
74
src/libio_mng/src/Makefile
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Local Makefile
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Workfile: Makefile $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Author: agibert $
|
||||||
|
# $Date: 2008/11/12 02:25:22 $
|
||||||
|
# $Revision: 1.1 $
|
||||||
|
# $Label: $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# IMR - Interlinking Message Router
|
||||||
|
# Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt)
|
||||||
|
# mailto:arnaud@rx3.net
|
||||||
|
# http://www.rx3.org/dvp/?dvp=imr
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# This file is part of IMR
|
||||||
|
#
|
||||||
|
# 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 2
|
||||||
|
# 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, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Var include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include ../../Makefile_var.mk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Variables
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
TARGET= libio_mng$(SHLIB_SUFFIX)
|
||||||
|
|
||||||
|
OBJ= libio_mng.o \
|
||||||
|
io_hdl_file.o
|
||||||
|
|
||||||
|
ifeq ($(TUX_SUPPORT),1)
|
||||||
|
OBJ+= io_hdl_tux.o
|
||||||
|
endif
|
||||||
|
|
||||||
|
ifeq ($(MQS_SUPPORT),1)
|
||||||
|
OBJ+= io_hdl_mqs.o
|
||||||
|
endif
|
||||||
|
|
||||||
|
EXTRA_INC=
|
||||||
|
|
||||||
|
EXTRA_LIB=
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Rule include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include ../../Makefile_rule.mk
|
541
src/libio_mng/src/io_hdl_file.c
Normal file
541
src/libio_mng/src/io_hdl_file.c
Normal file
@ -0,0 +1,541 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: io_hdl_file.c */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBIO_MNG_
|
||||||
|
#define _IO_HDL_FILE_C_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "io_hdl_file.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_File_Open */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to open */
|
||||||
|
/* Medium_Path: Medium Path to open */
|
||||||
|
/* Dir_Id: Medium open direction */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_File_Open( IMRT_Medium *Medium_Ptr, IMRT_Medium_Path Medium_Path, IMRT_Dir_Id Dir_Id)
|
||||||
|
{
|
||||||
|
char *type_ptr, *path_ptr, *read_ptr, *write_ptr;
|
||||||
|
|
||||||
|
|
||||||
|
if( Dir_Id == IMRD_DIR_ID_IN)
|
||||||
|
{
|
||||||
|
type_ptr = "r";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( Dir_Id == IMRD_DIR_ID_OUT)
|
||||||
|
{
|
||||||
|
type_ptr = "w";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Invalid Dir_Id (%d) !", Dir_Id);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ( path_ptr = strstr( Medium_Path, "@")) != NULL)
|
||||||
|
{
|
||||||
|
if( ( path_ptr == Medium_Path) || ( ( path_ptr - Medium_Path + 1) == strlen( Medium_Path)))
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Invalid file path [%s] !", Medium_Path);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
for( read_ptr = Medium_Path, write_ptr = Medium_Ptr->File.Delim; read_ptr < path_ptr; read_ptr++, write_ptr++)
|
||||||
|
{
|
||||||
|
if( ( *read_ptr == '\\') && ( read_ptr < ( path_ptr - 1)))
|
||||||
|
{
|
||||||
|
switch( *( read_ptr + 1))
|
||||||
|
{
|
||||||
|
case 'n':
|
||||||
|
{
|
||||||
|
*write_ptr = '\n';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case 't':
|
||||||
|
{
|
||||||
|
*write_ptr = '\t';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case '\\':
|
||||||
|
{
|
||||||
|
*write_ptr = '\n';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
*write_ptr = '?';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
read_ptr++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*write_ptr = *read_ptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*write_ptr = '\0';
|
||||||
|
|
||||||
|
Medium_Ptr->File.Delim_Len = write_ptr - Medium_Ptr->File.Delim;
|
||||||
|
Medium_Ptr->File.Msg_Len = 0;
|
||||||
|
|
||||||
|
strcpy( Medium_Ptr->File.Path, ( path_ptr + 1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( ( path_ptr = strstr( Medium_Path, "#")) != NULL)
|
||||||
|
{
|
||||||
|
if( ( path_ptr == Medium_Path) || ( ( path_ptr - Medium_Path + 1) == strlen( Medium_Path)))
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Invalid file path [%s] !", Medium_Path);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
Medium_Ptr->File.Delim_Len = 0;
|
||||||
|
Medium_Ptr->File.Delim[ Medium_Ptr->File.Delim_Len] = '\0';
|
||||||
|
|
||||||
|
Medium_Ptr->File.Msg_Len = atoi( Medium_Path);
|
||||||
|
|
||||||
|
if( Medium_Ptr->File.Msg_Len <= 0)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Invalid message len [%s] !", Medium_Path);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy( Medium_Ptr->File.Path, ( path_ptr + 1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Medium_Ptr->File.Delim_Len = 0;
|
||||||
|
Medium_Ptr->File.Delim[ Medium_Ptr->File.Delim_Len] = '\0';
|
||||||
|
|
||||||
|
Medium_Ptr->File.Msg_Len = 0;
|
||||||
|
|
||||||
|
strcpy( Medium_Ptr->File.Path, Medium_Path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ( Medium_Ptr->File.Handle_Ptr = fopen( Medium_Ptr->File.Path, type_ptr)) == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "Can't open file [%s] (%d) !", Medium_Ptr->File.Path, errno);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ( Medium_Ptr->File.Buffer_Ptr = malloc( IMRD_FILE_BUFFER_SIZE)) == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't allocate File_Buffer (%d) !", errno);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
Medium_Ptr->File.Buffer_Len = 0;
|
||||||
|
Medium_Ptr->File.Cur_Ptr = Medium_Ptr->File.Buffer_Ptr + IMRD_FILE_BUFFER_LEN;
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_4( IMRD_LOG_LEVEL_VERBOSE_1, "File: [%s] mode: [%s] delim: [%s] len: [%ld] opened !", Medium_Ptr->File.Path, type_ptr, Medium_Ptr->File.Delim, Medium_Ptr->File.Msg_Len);
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_File_Close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_File_Close( IMRT_Medium *Medium_Ptr)
|
||||||
|
{
|
||||||
|
if( Medium_Ptr->File.Buffer_Ptr != NULL)
|
||||||
|
{
|
||||||
|
free( Medium_Ptr->File.Buffer_Ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( fclose( Medium_Ptr->File.Handle_Ptr) == EOF)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "Can't close file [%s] (%d) !", Medium_Ptr->File.Path, errno);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_1( IMRD_LOG_LEVEL_VERBOSE_1, "File: [%s] closed !", Medium_Ptr->File.Path);
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_File_Mem_Str */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Occur_Ptr_Ptr: Pointer to the first occurrence */
|
||||||
|
/* Area_Ptr: Memory Area */
|
||||||
|
/* Area_Size: Size of the Area_Ptr */
|
||||||
|
/* Search_Ptr: Area to search in Area_Ptr */
|
||||||
|
/* Search_Size: Size of the Search_Ptr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_File_Mem_Str( char **Occur_Ptr_Ptr, const char *Area_Ptr, size_t Area_Size, const char *Search_Ptr, size_t Search_Size)
|
||||||
|
{
|
||||||
|
|
||||||
|
char * Pos = (char *)Area_Ptr;
|
||||||
|
|
||||||
|
*Occur_Ptr_Ptr = NULL;
|
||||||
|
|
||||||
|
while((Pos != NULL) && (*Occur_Ptr_Ptr == NULL))
|
||||||
|
{
|
||||||
|
Pos = memchr(Pos, Search_Ptr[0], Area_Size - (Pos - Area_Ptr));
|
||||||
|
if ((Area_Size - (Pos - Area_Ptr)) < Search_Size)
|
||||||
|
{
|
||||||
|
Pos = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Pos != NULL)
|
||||||
|
{
|
||||||
|
if (memcmp(Pos, Search_Ptr, Search_Size) == 0)
|
||||||
|
{
|
||||||
|
*Occur_Ptr_Ptr = Pos;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Pos += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_File_Read */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer_Ptr: Buffer to write data in */
|
||||||
|
/* Read_Len_Ptr: Number of byte readen */
|
||||||
|
/* Medium_Path: Medium to read */
|
||||||
|
/* Read_Mode: Read mode */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_File_Read( IMRT_Buffer *Buffer_Ptr, size_t *Read_Len_Ptr, IMRT_Medium *Medium_Ptr, IMRT_Read_Mode Read_Mode)
|
||||||
|
{
|
||||||
|
IMRT_Buffer_Data *next_ptr;
|
||||||
|
IMRT_Buffer_Data *delim_ptr;
|
||||||
|
IMRT_Buffer_Data *buffer_data_ptr = NULL;
|
||||||
|
size_t buffer_data_size = 1;
|
||||||
|
size_t copy_data_size = 0;
|
||||||
|
size_t read_buffer_len = IMRD_FILE_BUFFER_LEN - Medium_Ptr->File.Delim_Len;
|
||||||
|
IMRT_Status status_tmp;
|
||||||
|
|
||||||
|
*Read_Len_Ptr = 0;
|
||||||
|
|
||||||
|
if( Medium_Ptr->File.Msg_Len > 0) /* Msg_Len split mode */
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if( Medium_Ptr->File.Cur_Ptr >= ( Medium_Ptr->File.Buffer_Ptr + Medium_Ptr->File.Buffer_Len)) /* File needs to be read */
|
||||||
|
{
|
||||||
|
Medium_Ptr->File.Cur_Ptr = Medium_Ptr->File.Buffer_Ptr;
|
||||||
|
|
||||||
|
Medium_Ptr->File.Buffer_Len = fread( Medium_Ptr->File.Buffer_Ptr, sizeof( char), IMRD_FILE_BUFFER_LEN, Medium_Ptr->File.Handle_Ptr);
|
||||||
|
|
||||||
|
if( ferror( Medium_Ptr->File.Handle_Ptr) != 0)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "Can't read file [%s] (%d) !", Medium_Ptr->File.Path, ferror( Medium_Ptr->File.Handle_Ptr));
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
copy_data_size = IMRD_MIN( ( Medium_Ptr->File.Buffer_Len - ( Medium_Ptr->File.Cur_Ptr - Medium_Ptr->File.Buffer_Ptr)),
|
||||||
|
( Medium_Ptr->File.Msg_Len - buffer_data_size + 1));
|
||||||
|
|
||||||
|
if( copy_data_size != 0)
|
||||||
|
{
|
||||||
|
if( ( buffer_data_ptr = realloc( buffer_data_ptr, ( buffer_data_size + copy_data_size))) == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't allocate Buffer_Data (%d) !", errno);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy( ( buffer_data_ptr + buffer_data_size - 1), Medium_Ptr->File.Cur_Ptr, copy_data_size); /* Copy data from read buffer to copy buffer */
|
||||||
|
buffer_data_size += copy_data_size;
|
||||||
|
|
||||||
|
Medium_Ptr->File.Cur_Ptr += copy_data_size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while( ( buffer_data_size < Medium_Ptr->File.Msg_Len) && ( Medium_Ptr->File.Buffer_Len > 0));
|
||||||
|
}
|
||||||
|
else /* Delimitor split mode */
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if( Medium_Ptr->File.Cur_Ptr >= ( Medium_Ptr->File.Buffer_Ptr + read_buffer_len)) /* File needs to be read */
|
||||||
|
{
|
||||||
|
if( Medium_Ptr->File.Cur_Ptr < ( Medium_Ptr->File.Buffer_Ptr + IMRD_FILE_BUFFER_LEN)) /* Footer needs to be moved to header */
|
||||||
|
{
|
||||||
|
Medium_Ptr->File.Buffer_Len += Medium_Ptr->File.Buffer_Ptr - Medium_Ptr->File.Cur_Ptr;
|
||||||
|
memcpy( Medium_Ptr->File.Buffer_Ptr, Medium_Ptr->File.Cur_Ptr, Medium_Ptr->File.Buffer_Len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Medium_Ptr->File.Buffer_Len = 0; /* Buffer is empty */
|
||||||
|
}
|
||||||
|
|
||||||
|
Medium_Ptr->File.Cur_Ptr = Medium_Ptr->File.Buffer_Ptr;
|
||||||
|
|
||||||
|
Medium_Ptr->File.Buffer_Len += fread( ( Medium_Ptr->File.Buffer_Ptr + Medium_Ptr->File.Buffer_Len),
|
||||||
|
sizeof( char), ( IMRD_FILE_BUFFER_LEN - Medium_Ptr->File.Buffer_Len),
|
||||||
|
Medium_Ptr->File.Handle_Ptr);
|
||||||
|
|
||||||
|
if( ferror( Medium_Ptr->File.Handle_Ptr) != 0)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "Can't read file [%s] (%d) !", Medium_Ptr->File.Path, ferror( Medium_Ptr->File.Handle_Ptr));
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
status_tmp = IO_Hdl_File_Mem_Str(&delim_ptr, Medium_Ptr->File.Cur_Ptr, Medium_Ptr->File.Buffer_Len - (Medium_Ptr->File.Cur_Ptr - Medium_Ptr->File.Buffer_Ptr), Medium_Ptr->File.Delim, Medium_Ptr->File.Delim_Len);
|
||||||
|
|
||||||
|
if( ( Medium_Ptr->File.Delim_Len == 0) || ( delim_ptr == NULL)) /* Seek delim. */
|
||||||
|
{
|
||||||
|
delim_ptr = Medium_Ptr->File.Buffer_Ptr + IMRD_MIN( Medium_Ptr->File.Buffer_Len, read_buffer_len); /* No delimitor */
|
||||||
|
next_ptr = delim_ptr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
next_ptr = delim_ptr + Medium_Ptr->File.Delim_Len; /* Delimitor found */
|
||||||
|
*Read_Len_Ptr = *Read_Len_Ptr + Medium_Ptr->File.Delim_Len;
|
||||||
|
}
|
||||||
|
|
||||||
|
copy_data_size = delim_ptr - Medium_Ptr->File.Cur_Ptr;
|
||||||
|
|
||||||
|
if( copy_data_size != 0)
|
||||||
|
{
|
||||||
|
if( ( buffer_data_ptr = realloc( buffer_data_ptr, ( buffer_data_size + copy_data_size))) == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't allocate Buffer_Data (%d) !", errno);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy( ( buffer_data_ptr + buffer_data_size - 1), Medium_Ptr->File.Cur_Ptr, copy_data_size); /* Copy data from read buffer to copy buffer */
|
||||||
|
buffer_data_size += copy_data_size;
|
||||||
|
|
||||||
|
Medium_Ptr->File.Cur_Ptr = next_ptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while( ( next_ptr == delim_ptr) && ( Medium_Ptr->File.Buffer_Len >= read_buffer_len));
|
||||||
|
}
|
||||||
|
|
||||||
|
if( IMR_SDM_Fmt_Id_Get( &( Buffer_Ptr->Fmt_Id), "Fixed") != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't get FmtId: (%d) !", Buffer_Ptr->Fmt_Id);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( buffer_data_size <= 1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_1( IMRD_LOG_LEVEL_VERBOSE_1, "No more data to read from file: [%s] !", Medium_Ptr->File.Path);
|
||||||
|
|
||||||
|
return( IMRS_NO_DATA);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buffer_data_ptr[ ( buffer_data_size - 1)] = '\0';
|
||||||
|
|
||||||
|
Buffer_Ptr->Data_Buf_Ptr = buffer_data_ptr;
|
||||||
|
Buffer_Ptr->Data_Buf_Len = buffer_data_size - 1;
|
||||||
|
Buffer_Ptr->Data_Buf_Size = buffer_data_size;
|
||||||
|
Buffer_Ptr->Status = IMRD_BUFFER_STATUS_ALLOCATED;
|
||||||
|
|
||||||
|
*Read_Len_Ptr = *Read_Len_Ptr + buffer_data_size - 1;
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_2( IMRD_LOG_LEVEL_VERBOSE_1, "Read (%d) bytes from file: [%s] ", Buffer_Ptr->Data_Buf_Len, Medium_Ptr->File.Path);
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_File_Write */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to write data to */
|
||||||
|
/* Write_Len_Ptr: Number of byte writen */
|
||||||
|
/* Buffer_Ptr: Buffer to read */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_File_Write( IMRT_Medium *Medium_Ptr, size_t *Write_Len_Ptr, IMRT_Buffer *Buffer_Ptr)
|
||||||
|
{
|
||||||
|
char *padding_buffer_ptr;
|
||||||
|
long padding_len;
|
||||||
|
|
||||||
|
|
||||||
|
*Write_Len_Ptr = 0;
|
||||||
|
|
||||||
|
if( ( Medium_Ptr->File.Delim_Len != 0) && ( Medium_Ptr->Msg_Nb > 0))
|
||||||
|
{
|
||||||
|
*Write_Len_Ptr = fwrite( Medium_Ptr->File.Delim, sizeof( char), Medium_Ptr->File.Delim_Len, Medium_Ptr->File.Handle_Ptr);
|
||||||
|
|
||||||
|
if( ferror( Medium_Ptr->File.Handle_Ptr) != 0)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "Can't write file [%s] (%d) !", Medium_Ptr->URL, ferror( Medium_Ptr->File.Handle_Ptr));
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
padding_len = Medium_Ptr->File.Msg_Len - Buffer_Ptr->Data_Buf_Len;
|
||||||
|
|
||||||
|
if( Medium_Ptr->File.Msg_Len != 0 )
|
||||||
|
{
|
||||||
|
if( padding_len < 2)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "Buffer size: (%d) too big for message split size: (%d) !", Buffer_Ptr->Data_Buf_Len, Medium_Ptr->File.Msg_Len);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ( padding_buffer_ptr = malloc( padding_len)) == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't allocate padding_buffer (%d) !", errno);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
memset( padding_buffer_ptr, ' ', padding_len);
|
||||||
|
|
||||||
|
padding_buffer_ptr[0] = '\0';
|
||||||
|
padding_buffer_ptr[1] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
*Write_Len_Ptr += fwrite( Buffer_Ptr->Data_Buf_Ptr, sizeof( char), Buffer_Ptr->Data_Buf_Len, Medium_Ptr->File.Handle_Ptr);
|
||||||
|
|
||||||
|
if( ferror( Medium_Ptr->File.Handle_Ptr) != 0)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "Can't write data in file [%s] (%d) !", Medium_Ptr->URL, ferror( Medium_Ptr->File.Handle_Ptr));
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Medium_Ptr->File.Msg_Len != 0 )
|
||||||
|
{
|
||||||
|
*Write_Len_Ptr += fwrite( padding_buffer_ptr, sizeof( char), padding_len, Medium_Ptr->File.Handle_Ptr);
|
||||||
|
|
||||||
|
free( padding_buffer_ptr);
|
||||||
|
|
||||||
|
if( ferror( Medium_Ptr->File.Handle_Ptr) != 0)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "Can't write padding in file [%s] (%d) !", Medium_Ptr->URL, ferror( Medium_Ptr->File.Handle_Ptr));
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fflush( Medium_Ptr->File.Handle_Ptr);
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_2( IMRD_LOG_LEVEL_VERBOSE_1, "Wrote (%d) bytes to file: [%s] ", *Write_Len_Ptr, Medium_Ptr->File.Path);
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_File_Begin */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Medium *Medium_Ptr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_File_Begin( IMRT_Medium *Medium_Ptr)
|
||||||
|
{
|
||||||
|
return(IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_File_Commit */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Medium *Medium_Ptr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_File_Commit( IMRT_Medium *Medium_Ptr)
|
||||||
|
{
|
||||||
|
return(IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_File_Rollback */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Medium *Medium_Ptr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_File_Rollback( IMRT_Medium *Medium_Ptr)
|
||||||
|
{
|
||||||
|
return(IMRS_OK);
|
||||||
|
}
|
149
src/libio_mng/src/io_hdl_file.h
Normal file
149
src/libio_mng/src/io_hdl_file.h
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: libio_mng.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _IO_HDL_FILE_H_
|
||||||
|
#define _IO_HDL_FILE_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <libio_mng.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Defines */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _IO_HDL_FILE_C_
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_File_Open( IMRT_Medium *, IMRT_Medium_Path, IMRT_Dir_Id);
|
||||||
|
IMRT_Status IO_Hdl_File_Close( IMRT_Medium *);
|
||||||
|
IMRT_Status IO_Hdl_File_Mem_Str( char **, const char *, size_t, const char *, size_t);
|
||||||
|
IMRT_Status IO_Hdl_File_Read( IMRT_Buffer *, size_t *, IMRT_Medium *, IMRT_Read_Mode);
|
||||||
|
IMRT_Status IO_Hdl_File_Write( IMRT_Medium *, size_t *, IMRT_Buffer *);
|
||||||
|
IMRT_Status IO_Hdl_File_Begin( IMRT_Medium *Medium_Ptr);
|
||||||
|
IMRT_Status IO_Hdl_File_Commit( IMRT_Medium *Medium_Ptr);
|
||||||
|
IMRT_Status IO_Hdl_File_Rollback( IMRT_Medium *Medium_Ptr);
|
||||||
|
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_File_Open */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to open */
|
||||||
|
/* Medium_Path: Medium Path to open */
|
||||||
|
/* Dir_Id: Medium open direction */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern IMRT_Status IO_Hdl_File_Open( IMRT_Medium *, IMRT_Medium_Path, IMRT_Dir_Id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_File_Close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern IMRT_Status IO_Hdl_File_Close( IMRT_Medium *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_File_Read */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer_Ptr: Buffer to write data in */
|
||||||
|
/* Read_Len_Ptr: Number of byte readen */
|
||||||
|
/* Medium_Path: Medium to read */
|
||||||
|
/* Read_Mode: Read mode */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern IMRT_Status IO_Hdl_File_Read( IMRT_Buffer *, size_t *, IMRT_Medium *, IMRT_Read_Mode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_File_Write */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium towrite data to */
|
||||||
|
/* Write_Len_Ptr: Number of byte writen */
|
||||||
|
/* Buffer_Ptr: Buffer to read */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_File_Write( IMRT_Medium *, size_t *, IMRT_Buffer *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_File_Begin */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Medium *Medium_Ptr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
extern IMRT_Status IO_Hdl_File_Begin( IMRT_Medium *Medium_Ptr);
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_File_Commit */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Medium *Medium_Ptr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
extern IMRT_Status IO_Hdl_File_Commit( IMRT_Medium *Medium_Ptr);
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_File_Rollback */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Medium *Medium_Ptr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
extern IMRT_Status IO_Hdl_File_Rollback( IMRT_Medium *Medium_Ptr);
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
433
src/libio_mng/src/io_hdl_mqs.c
Normal file
433
src/libio_mng/src/io_hdl_mqs.c
Normal file
@ -0,0 +1,433 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: io_hdl_mqs.c */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBIO_MNG_
|
||||||
|
#define _IO_HDL_MQS_C_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "io_hdl_mqs.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_MQS_Open */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to open */
|
||||||
|
/* Medium_Path: Medium Path to open */
|
||||||
|
/* Dir_Id: Medium open direction */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_MQS_Open( IMRT_Medium *Medium_Ptr, IMRT_Medium_Path Medium_Path, IMRT_Dir_Id Dir_Id)
|
||||||
|
{
|
||||||
|
MQLONG comp_code; /* completion code */
|
||||||
|
MQLONG reason_code; /* reason code */
|
||||||
|
char *pos_slash_ptr;
|
||||||
|
MQOD od = {MQOD_DEFAULT}; /* Object Descriptor */
|
||||||
|
MQLONG options; /* MQOPEN/MQCLOSE options */
|
||||||
|
|
||||||
|
|
||||||
|
if( Dir_Id == IMRD_DIR_ID_IN)
|
||||||
|
{
|
||||||
|
/*positionnenment des option d'ouverture du de la Queue*/
|
||||||
|
options = MQOO_INPUT_AS_Q_DEF | MQOO_FAIL_IF_QUIESCING; /* open queue for input but not if MQM stopping */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( Dir_Id == IMRD_DIR_ID_OUT)
|
||||||
|
{
|
||||||
|
/*positionnenment des option d'ouverture du de la Queue*/
|
||||||
|
options = MQOO_OUTPUT | MQOO_FAIL_IF_QUIESCING; /* open queue for output but not if MQM stopping */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Invalid Dir_Id (%d) !", Dir_Id);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pos_slash_ptr = strstr( Medium_Path, "/");
|
||||||
|
|
||||||
|
if( pos_slash_ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Invalid mqs path [%s] !", Medium_Path);
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
strncpy( Medium_Ptr->MQS.Queue_Mng, Medium_Path, strlen( Medium_Path) - strlen( pos_slash_ptr));
|
||||||
|
Medium_Ptr->MQS.Queue_Mng[ strlen( Medium_Path) - strlen( pos_slash_ptr)] = '\0';
|
||||||
|
|
||||||
|
strcpy( Medium_Ptr->MQS.Queue_Name, ( pos_slash_ptr + 1));
|
||||||
|
|
||||||
|
/*queue manager connection*/
|
||||||
|
MQCONN( Medium_Ptr->MQS.Queue_Mng, &( Medium_Ptr->MQS.Conn_Hdl), &comp_code, &reason_code);
|
||||||
|
|
||||||
|
if( comp_code == MQCC_FAILED)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "MQCONN ended with reason code (%d) for this path [%s] !", reason_code, Medium_Path);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy( od.ObjectName, Medium_Ptr->MQS.Queue_Name);
|
||||||
|
|
||||||
|
/*open the queue*/
|
||||||
|
MQOPEN( Medium_Ptr->MQS.Conn_Hdl, &od, options, &( Medium_Ptr->MQS.Obj_Hdl), &comp_code, &reason_code);
|
||||||
|
|
||||||
|
/* report reason, if any; stop if failed */
|
||||||
|
if( reason_code != MQRC_NONE)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "MQOPEN ended with reason code (%d) for this path [%s] !", reason_code, Medium_Path);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( comp_code == MQCC_FAILED)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Unable to open queue for this path [%s] !", Medium_Path);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_3( IMRD_LOG_LEVEL_VERBOSE_1, "Queue_Mng: [%s] Queue: [%s] Dir: [%s] opened !", Medium_Ptr->MQS.Queue_Mng, Medium_Ptr->MQS.Queue_Name, ( ( Dir_Id == IMRD_DIR_ID_IN) ? "in" : ( ( Dir_Id == IMRD_DIR_ID_OUT) ? "out" : "unknown")));
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_MQS_Close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_MQS_Close( IMRT_Medium *Medium_Ptr)
|
||||||
|
{
|
||||||
|
MQLONG comp_code; /* completion code */
|
||||||
|
MQLONG reason_code; /* reason code */
|
||||||
|
char *pos_slash_ptr;
|
||||||
|
MQOD od = {MQOD_DEFAULT}; /* Object Descriptor */
|
||||||
|
|
||||||
|
|
||||||
|
MQCLOSE( Medium_Ptr->MQS.Conn_Hdl, &( Medium_Ptr->MQS.Obj_Hdl), MQCO_NONE, &comp_code, &reason_code);
|
||||||
|
|
||||||
|
if( reason_code != MQRC_NONE)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "MQCLOSE ended with reason code [%d] for queue: [%s] !", reason_code, Medium_Ptr->MQS.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
MQDISC( &Medium_Ptr->MQS.Conn_Hdl, &comp_code, &reason_code);
|
||||||
|
|
||||||
|
/* report reason, if any */
|
||||||
|
if( reason_code != MQRC_NONE)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "MQCLOSE ended with reason code [%d] for queue: [%s] !", reason_code, Medium_Ptr->MQS.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_2( IMRD_LOG_LEVEL_VERBOSE_1, "Queue_Mng: [%s] Queue: [%s] closed !", Medium_Ptr->MQS.Queue_Mng, Medium_Ptr->MQS.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_MQS_Read */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer_Ptr: Buffer to write data in */
|
||||||
|
/* Read_Len_Ptr: Number of byte writen */
|
||||||
|
/* Medium_Path: Medium to read */
|
||||||
|
/* Read_Mode: Read mode */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_MQS_Read( IMRT_Buffer *Buffer_Ptr, size_t *Read_Len_Ptr, IMRT_Medium *Medium_Ptr, IMRT_Read_Mode Read_Mode)
|
||||||
|
{
|
||||||
|
MQLONG comp_code; /* completion code */
|
||||||
|
MQLONG reason_code; /* reason code */
|
||||||
|
IMRT_MQS_Buffer *buffer_ptr;
|
||||||
|
MQLONG buffer_len;
|
||||||
|
MQGMO gmo = {MQGMO_DEFAULT}; /* get message options */
|
||||||
|
MQMD md = {MQMD_DEFAULT}; /* Message Descriptor */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
switch( Read_Mode)
|
||||||
|
{
|
||||||
|
case IMRD_READ_MODE_WAIT:
|
||||||
|
{
|
||||||
|
gmo.Options = MQGMO_WAIT ;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case IMRD_READ_MODE_NO_WAIT:
|
||||||
|
{
|
||||||
|
gmo.Options = MQGMO_NO_WAIT ;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Unknown Read_Mode: (%d) !", Read_Mode);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gmo.Options |= MQGMO_CONVERT;
|
||||||
|
|
||||||
|
if( Medium_Ptr->Tran_Flag == IMRD_MEDIUM_TRAN_FLAG_IN)
|
||||||
|
{
|
||||||
|
gmo.Options |= MQGMO_SYNCPOINT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// gmo.WaitInterval = MQWI_UNLIMITED;
|
||||||
|
gmo.WaitInterval = 10000;
|
||||||
|
|
||||||
|
if( ( buffer_ptr = malloc( IMRD_MQS_BUFFER_SIZE)) == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't allocate MQS Buffer (%d) !", errno);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
memcpy( md.MsgId, MQMI_NONE, sizeof(md.MsgId));
|
||||||
|
memcpy( md.CorrelId, MQCI_NONE, sizeof(md.CorrelId));
|
||||||
|
md.Encoding = MQENC_NATIVE;
|
||||||
|
md.CodedCharSetId = MQCCSI_Q_MGR;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
|
||||||
|
MQGET( Medium_Ptr->MQS.Conn_Hdl, Medium_Ptr->MQS.Obj_Hdl, &md, &gmo, IMRD_MQS_BUFFER_SIZE, buffer_ptr, &buffer_len, &comp_code, &reason_code);
|
||||||
|
|
||||||
|
} while( ( Read_Mode == IMRD_READ_MODE_WAIT) && ( reason_code == MQRC_NO_MSG_AVAILABLE) && ( IMRG_Base.Sig_Trapped == 0));
|
||||||
|
|
||||||
|
if( reason_code != MQRC_NONE)
|
||||||
|
{
|
||||||
|
if( reason_code == MQRC_NO_MSG_AVAILABLE)
|
||||||
|
{
|
||||||
|
free( buffer_ptr);
|
||||||
|
|
||||||
|
if( IMRG_Base.Sig_Trapped == 0)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_2( IMRD_LOG_LEVEL_VERBOSE_1, "No more data to read from Queue_Mng: [%s] Queue: [%s] !", Medium_Ptr->MQS.Queue_Mng, Medium_Ptr->MQS.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_NO_DATA);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_2( IMRD_LOG_LEVEL_VERBOSE_1, "Signal received during reading from Queue_Mng: [%s] Queue: [%s] !", Medium_Ptr->MQS.Queue_Mng, Medium_Ptr->MQS.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_SIGNAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( reason_code == MQRC_TRUNCATED_MSG_FAILED)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "MQGET failed: truncated message rc: [%d] for queue: [%s] !", reason_code, Medium_Ptr->MQS.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "MQGET failed: rc: [%d] for queue: [%s] !", reason_code, Medium_Ptr->MQS.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( comp_code == MQCC_FAILED)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "MQGET failed: ??? rc: [%d] for queue: [%s] !", reason_code, Medium_Ptr->MQS.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
buffer_ptr[ buffer_len] = '\0'; /* add terminator */
|
||||||
|
|
||||||
|
Buffer_Ptr->Data_Buf_Ptr = (IMRT_Buffer_Data *)buffer_ptr;
|
||||||
|
Buffer_Ptr->Data_Buf_Len = (size_t)buffer_len;
|
||||||
|
Buffer_Ptr->Data_Buf_Size = IMRD_MQS_BUFFER_SIZE;
|
||||||
|
Buffer_Ptr->Status = IMRD_BUFFER_STATUS_ALLOCATED;
|
||||||
|
|
||||||
|
*Read_Len_Ptr = Buffer_Ptr->Data_Buf_Len;
|
||||||
|
|
||||||
|
if( IMR_SDM_Fmt_Id_Get( &( Buffer_Ptr->Fmt_Id), "Fixed") != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't get FmtId: (%d) !", Buffer_Ptr->Fmt_Id);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_3( IMRD_LOG_LEVEL_VERBOSE_1, "Read (%d) bytes from Queue_Mng: [%s] Queue: [%s] !", Buffer_Ptr->Data_Buf_Len, Medium_Ptr->MQS.Queue_Mng, Medium_Ptr->MQS.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_MQS_Write */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to write data to */
|
||||||
|
/* Write_Len_Ptr: Number of byte writen */
|
||||||
|
/* Buffer_Ptr: Buffer to read */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_MQS_Write( IMRT_Medium *Medium_Ptr, size_t *Write_Len_Ptr, IMRT_Buffer *Buffer_Ptr)
|
||||||
|
{
|
||||||
|
MQLONG comp_code; /* completion code */
|
||||||
|
MQLONG reason_code; /* reason code */
|
||||||
|
MQPMO pmo = {MQPMO_DEFAULT}; /* put message options */
|
||||||
|
MQMD md = {MQMD_DEFAULT}; /* Message Descriptor */
|
||||||
|
|
||||||
|
|
||||||
|
memcpy( md.Format, MQFMT_STRING, (size_t)MQ_FORMAT_LENGTH);
|
||||||
|
|
||||||
|
pmo.Options |= MQPMO_NEW_MSG_ID | MQPMO_NEW_CORREL_ID;
|
||||||
|
|
||||||
|
if( Medium_Ptr->Tran_Flag == IMRD_MEDIUM_TRAN_FLAG_IN)
|
||||||
|
{
|
||||||
|
pmo.Options |= MQPMO_SYNCPOINT;
|
||||||
|
}
|
||||||
|
|
||||||
|
MQPUT( Medium_Ptr->MQS.Conn_Hdl, Medium_Ptr->MQS.Obj_Hdl, &md, &pmo, (MQLONG)( Buffer_Ptr->Data_Buf_Len), Buffer_Ptr->Data_Buf_Ptr, &comp_code, &reason_code);
|
||||||
|
|
||||||
|
if( reason_code != MQRC_NONE)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "MQPUT failed: (%d) for queue: [%s] !", reason_code, Medium_Ptr->MQS.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*Write_Len_Ptr = Buffer_Ptr->Data_Buf_Len;
|
||||||
|
IMRD_LM_LOG_TRACE_3( IMRD_LOG_LEVEL_VERBOSE_1, "Wrote (%d) bytes to Queue_Mng: [%s] Queue: [%s]!", *Write_Len_Ptr, Medium_Ptr->MQS.Queue_Mng, Medium_Ptr->MQS.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_MQS_Begin */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_MQS_Begin( IMRT_Medium *Medium_Ptr)
|
||||||
|
{
|
||||||
|
|
||||||
|
return(IMRS_OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_MQS_Commit */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_MQS_Commit( IMRT_Medium *Medium_Ptr)
|
||||||
|
{
|
||||||
|
MQLONG comp_code; /* completion code */
|
||||||
|
MQLONG reason_code; /* reason code */
|
||||||
|
IMRT_Status status;
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
MQCMIT(Medium_Ptr->MQS.Conn_Hdl,
|
||||||
|
&comp_code,
|
||||||
|
&reason_code);
|
||||||
|
if( reason_code != MQRC_NONE)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "MQCMIT failed: (%d) for queue: [%s] !", reason_code, Medium_Ptr->MQS.Queue_Name);
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
return(status);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_MQS_Rollback */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_MQS_Rollback( IMRT_Medium *Medium_Ptr)
|
||||||
|
{
|
||||||
|
MQLONG comp_code; /* completion code */
|
||||||
|
MQLONG reason_code; /* reason code */
|
||||||
|
IMRT_Status status;
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
MQBACK(Medium_Ptr->MQS.Conn_Hdl,
|
||||||
|
&comp_code,
|
||||||
|
&reason_code);
|
||||||
|
if( reason_code != MQRC_NONE)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "MQBACK failed: (%d) for queue: [%s] !", reason_code, Medium_Ptr->MQS.Queue_Name);
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(status);
|
||||||
|
|
||||||
|
}
|
149
src/libio_mng/src/io_hdl_mqs.h
Normal file
149
src/libio_mng/src/io_hdl_mqs.h
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: io_hdl_mqs.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _IO_HDL_MQS_H_
|
||||||
|
#define _IO_HDL_MQS_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <libio_mng.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Defines */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _IO_HDL_MQS_C_
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_MQS_Open( IMRT_Medium *, IMRT_Medium_Path, IMRT_Dir_Id);
|
||||||
|
IMRT_Status IO_Hdl_MQS_Close( IMRT_Medium *);
|
||||||
|
IMRT_Status IO_Hdl_MQS_Read( IMRT_Buffer *, size_t *, IMRT_Medium *, IMRT_Read_Mode);
|
||||||
|
IMRT_Status IO_Hdl_MQS_Write( IMRT_Medium *, size_t *, IMRT_Buffer *);
|
||||||
|
IMRT_Status IO_Hdl_MQS_Commit( IMRT_Medium *);
|
||||||
|
IMRT_Status IO_Hdl_MQS_Rollback( IMRT_Medium *);
|
||||||
|
IMRT_Status IO_Hdl_MQS_Begin( IMRT_Medium *);
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_MQS_Open */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to open */
|
||||||
|
/* Medium_Path: Medium Path to open */
|
||||||
|
/* Dir_Id: Medium open direction */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern IMRT_Status IO_Hdl_MQS_Open( IMRT_Medium *, IMRT_Medium_Path, IMRT_Dir_Id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_MQS_Close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern IMRT_Status IO_Hdl_MQS_Close( IMRT_Medium *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_MQS_Read */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer_Ptr: Buffer to write data in */
|
||||||
|
/* Read_Len_Ptr: Number of byte writen */
|
||||||
|
/* Medium_Path: Medium to read */
|
||||||
|
/* Read_Mode: Read mode */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern IMRT_Status IO_Hdl_MQS_Read( IMRT_Buffer *, size_t *, IMRT_Medium *, IMRT_Read_Mode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_MQS_Write */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium towrite data to */
|
||||||
|
/* Write_Len_Ptr: Number of byte writen */
|
||||||
|
/* Buffer_Ptr: Buffer to read */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern IMRT_Status IO_Hdl_MQS_Write( IMRT_Medium *, size_t *, IMRT_Buffer *);
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_MQS_Commit */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern IMRT_Status IO_Hdl_MQS_Commit( IMRT_Medium *);
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_MQS_Rollback */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern IMRT_Status IO_Hdl_MQS_Rollback( IMRT_Medium *);
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_MQS_Begin */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern IMRT_Status IO_Hdl_MQS_Begin( IMRT_Medium *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
595
src/libio_mng/src/io_hdl_tux.c
Normal file
595
src/libio_mng/src/io_hdl_tux.c
Normal file
@ -0,0 +1,595 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: io_hdl_tux.c */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBIO_MNG_
|
||||||
|
#define _IO_HDL_TUX_C_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "io_hdl_tux.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_Tux_Open */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to open */
|
||||||
|
/* Medium_Path: Medium Path to open */
|
||||||
|
/* Dir_Id: Medium open direction */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_Tux_Open( IMRT_Medium *Medium_Ptr, IMRT_Medium_Path Medium_Path, IMRT_Dir_Id Dir_Id)
|
||||||
|
{
|
||||||
|
char *Pos_Slash_Ptr;
|
||||||
|
|
||||||
|
|
||||||
|
Pos_Slash_Ptr = strstr(Medium_Path, "/");
|
||||||
|
|
||||||
|
if(Pos_Slash_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Invalid tux path [%s] !", Medium_Path);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strncpy(Medium_Ptr->Tux.Queue_Space, Medium_Path, strlen(Medium_Path) - strlen(Pos_Slash_Ptr));
|
||||||
|
Medium_Ptr->Tux.Queue_Space[strlen(Medium_Path) - strlen(Pos_Slash_Ptr)] = '\0';
|
||||||
|
|
||||||
|
strcpy(Medium_Ptr->Tux.Queue_Name, (Pos_Slash_Ptr + 1));
|
||||||
|
|
||||||
|
if( Queue_Exist( Medium_Ptr->Tux.Queue_Space, Medium_Ptr->Tux.Queue_Name) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "Tux Queue doesn't exist: Queue_Space: [%s] Queue: [%s] !", Medium_Ptr->Tux.Queue_Space, Medium_Ptr->Tux.Queue_Name);
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_2( IMRD_LOG_LEVEL_VERBOSE_1, "Queue_Space: [%s] Queue: [%s] opened !", Medium_Ptr->Tux.Queue_Space, Medium_Ptr->Tux.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_Tux_Close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_Tux_Close( IMRT_Medium *Medium_Ptr)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_2( IMRD_LOG_LEVEL_VERBOSE_1, "Queue_Space: [%s] Queue: [%s] closed !", Medium_Ptr->Tux.Queue_Space, Medium_Ptr->Tux.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_Tux_Read */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer_Ptr: Buffer to write data in */
|
||||||
|
/* Read_Len_Ptr: Number of byte writen */
|
||||||
|
/* Medium_Path: Medium to read */
|
||||||
|
/* Read_Mode: Read mode */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_Tux_Read( IMRT_Buffer *Buffer_Ptr, size_t *Read_Len_Ptr, IMRT_Medium *Medium_Ptr, IMRT_Read_Mode Read_Mode)
|
||||||
|
{
|
||||||
|
IMRT_Tux_Buffer *Tux_Buffer_Ptr = NULL;
|
||||||
|
TPQCTL queue_param;
|
||||||
|
long len;
|
||||||
|
long flags;
|
||||||
|
|
||||||
|
|
||||||
|
memset(queue_param.corrid, '\0', sizeof(queue_param.corrid));
|
||||||
|
|
||||||
|
switch( Read_Mode)
|
||||||
|
{
|
||||||
|
case IMRD_READ_MODE_WAIT:
|
||||||
|
{
|
||||||
|
queue_param.flags = TPQWAIT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case IMRD_READ_MODE_NO_WAIT:
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Unknown Read_Mode: (%d) !", Read_Mode);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
queue_param.diagnostic = 0L;
|
||||||
|
|
||||||
|
if( ( Tux_Buffer_Ptr = (IMRT_Tux_Buffer *)tpalloc(IMRD_FML_TYPE_32, NULL, IMRD_TUX_BUFFER_SIZE)) == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't allocate Tux_Buffer_Ptr [%s] !", tpstrerror(tperrno));
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Finit32( (IMRT_Tux_Buffer *)Tux_Buffer_Ptr, (FLDLEN32)IMRD_TUX_BUFFER_SIZE) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't initialize Tux_Buffer_Ptr [%s] !", Fstrerror32(Ferror32));
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if( tpdequeue( Medium_Ptr->Tux.Queue_Space, Medium_Ptr->Tux.Queue_Name, &queue_param, (char **)&Tux_Buffer_Ptr, &len, TPNOTIME) == -1)
|
||||||
|
{
|
||||||
|
switch( tperrno)
|
||||||
|
{
|
||||||
|
case TPGOTSIG:
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_2( IMRD_LOG_LEVEL_VERBOSE_1, "Signal received during reading from QSpace [%s] QueueName [%s] !", Medium_Ptr->Tux.Queue_Space, Medium_Ptr->Tux.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_SIGNAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
switch( queue_param.diagnostic)
|
||||||
|
{
|
||||||
|
case QMENOMSG:
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_2( IMRD_LOG_LEVEL_VERBOSE_1, "No more data to read from QSpace [%s] QueueName [%s] !", Medium_Ptr->Tux.Queue_Space, Medium_Ptr->Tux.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_NO_DATA);
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_4( "Can't read buffer from QSpace [%s] QueueName [%s] : [%s] [%d] !", Medium_Ptr->Tux.Queue_Space, Medium_Ptr->Tux.Queue_Name, tpstrerror(tperrno), queue_param.diagnostic);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Buffer_Ptr->Data_Buf_Ptr = (IMRT_Buffer_Data *)Tux_Buffer_Ptr;
|
||||||
|
Buffer_Ptr->Data_Buf_Len = Fused32( Tux_Buffer_Ptr);
|
||||||
|
Buffer_Ptr->Data_Buf_Size = Fsizeof32( Tux_Buffer_Ptr);
|
||||||
|
Buffer_Ptr->Status = IMRD_BUFFER_STATUS_ALLOCATED;
|
||||||
|
|
||||||
|
*Read_Len_Ptr = Buffer_Ptr->Data_Buf_Len;
|
||||||
|
|
||||||
|
if( IMR_SDM_Fmt_Id_Get( &( Buffer_Ptr->Fmt_Id), "FML") != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0( "Can't get FmtId !");
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_3( IMRD_LOG_LEVEL_VERBOSE_1, "Read (%d) bytes from Queue_Space: [%s] Queue: [%s] !", Buffer_Ptr->Data_Buf_Len, Medium_Ptr->Tux.Queue_Space, Medium_Ptr->Tux.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_Tux_Write */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to write data to */
|
||||||
|
/* Write_Len_Ptr: Number of byte writen */
|
||||||
|
/* Buffer_Ptr: Buffer to read */
|
||||||
|
/* Write_Len_Ptr: Number of byte writen */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_Tux_Write( IMRT_Medium *Medium_Ptr, size_t *Write_Len_Ptr, IMRT_Buffer *Buffer_Ptr)
|
||||||
|
{
|
||||||
|
TPQCTL queue_param;
|
||||||
|
|
||||||
|
memset( queue_param.corrid, '\0', sizeof( queue_param.corrid));
|
||||||
|
queue_param.flags = 0L;
|
||||||
|
queue_param.diagnostic = 0L;
|
||||||
|
|
||||||
|
if( tpenqueue( Medium_Ptr->Tux.Queue_Space, Medium_Ptr->Tux.Queue_Name, &queue_param, Buffer_Ptr->Data_Buf_Ptr, 0, TPNOFLAGS) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_3( "Can't write buffer to QSpace [%s] QueueName [%s] : [%s] !", Medium_Ptr->Tux.Queue_Space, Medium_Ptr->Tux.Queue_Name, tpstrerror(tperrno) );
|
||||||
|
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*Write_Len_Ptr = Buffer_Ptr->Data_Buf_Len;
|
||||||
|
IMRD_LM_LOG_TRACE_3( IMRD_LOG_LEVEL_VERBOSE_1, "Wrote (%d) bytes to Queue_Space: [%s] Queue: [%s]!", *Write_Len_Ptr, Medium_Ptr->Tux.Queue_Space, Medium_Ptr->Tux.Queue_Name);
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Queue_Alloc */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buf_Ptr_Ptr: Tuxedo Buffer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Queue_Alloc( IMRT_Tux_Buffer **Buf_Ptr_Ptr)
|
||||||
|
{
|
||||||
|
if( ( *Buf_Ptr_Ptr = (IMRT_Tux_Buffer *)tpalloc( IMRD_FML_TYPE_32, NULL, IMRD_TUX_BUFFER_SIZE)) == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't tpalloc Buffer: [%s] !", tpstrerror( tperrno));
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Finit32( (IMRT_Tux_Buffer *)*Buf_Ptr_Ptr, (FLDLEN32)IMRD_TUX_BUFFER_SIZE) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't Finit32 Buffer: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Queue_Free */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buf_Ptr: Tuxedo Buffer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Queue_Free( IMRT_Tux_Buffer *Buf_Ptr)
|
||||||
|
{
|
||||||
|
if( Buf_Ptr != NULL)
|
||||||
|
{
|
||||||
|
tpfree( (char *)Buf_Ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Queue_Exist_Mib */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Queue_Space: Queue Space Name */
|
||||||
|
/* Queue_Name: Queue Name */
|
||||||
|
/* Request_Buf_Ptr: Request Tuxedo Buffer */
|
||||||
|
/* Response_Buf_Ptr: Response Tuxedo Buffer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Queue_Exist_Mib( IMRT_Tux_Queue_Space Queue_Space, IMRT_Tux_Queue_Name Queue_Name, IMRT_Tux_Buffer *Request_Buf_Ptr, IMRT_Tux_Buffer *Response_Buf_Ptr)
|
||||||
|
{
|
||||||
|
IMRT_Tux_Lmid lmid;
|
||||||
|
long fldid1, fldid2;
|
||||||
|
long nb_occurs = 0L;
|
||||||
|
long rlen = 0L;
|
||||||
|
IMRT_Tux_Open_Info open_info;
|
||||||
|
char *qmconfig, *appqspacename;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
|
||||||
|
if( Fchg32( Request_Buf_Ptr, TA_OPERATION, 0, "GET", 0) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Fchg32 TA_OPERATION: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Fchg32( Request_Buf_Ptr, TA_CLASS, 0, "T_GROUP", 0) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Fchg32 TA_CLASS: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Fchg32( Request_Buf_Ptr, TA_TMSNAME, 0, "TMS_QM", 0) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Fchg32 TA_TMSNAME: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
fldid1 = TA_OPENINFO;
|
||||||
|
if( Fchg32( Request_Buf_Ptr, TA_FILTER, 0, (char *)&fldid1, 0) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Fchg32 TA_FILTER: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
fldid2 = TA_LMID;
|
||||||
|
if( Fchg32( Request_Buf_Ptr, TA_FILTER, 1, (char *)&fldid2, 0) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Fchg32 TA_FILTER: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( tpcall( IMRD_TMIB_SERVICE, (void *)Request_Buf_Ptr,0, (char**)&Response_Buf_Ptr, &rlen, 0L) < 0)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Error tpcall: [%s] !", tpstrerror( tperrno));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Fget32( Response_Buf_Ptr, TA_OCCURS, 0, (char *)&nb_occurs, NULL) == -1 )
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Fget32 TA_OCCURS: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
for( i=0; i < nb_occurs; i++)
|
||||||
|
{
|
||||||
|
if( Fget32( Response_Buf_Ptr, TA_OPENINFO, i, open_info, NULL) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Fget32 TA_OPENINFO: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
qmconfig = (char *)strchr(open_info, ':')+1;
|
||||||
|
appqspacename = (char *)strchr(qmconfig, ':');
|
||||||
|
appqspacename[0] = 0;
|
||||||
|
appqspacename++;
|
||||||
|
|
||||||
|
if( strcmp( appqspacename, Queue_Space) == 0)
|
||||||
|
{
|
||||||
|
i = nb_occurs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Fget32( Response_Buf_Ptr, TA_LMID, 0, lmid, NULL) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Fget32 TA_LMID: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Finit32( (FBFR32 *)Request_Buf_Ptr, (FLDLEN32)IMRD_TUX_BUFFER_SIZE) == -1 )
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Finit32 Buffer1: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Finit32( (FBFR32 *)Response_Buf_Ptr, (FLDLEN32)IMRD_TUX_BUFFER_SIZE) == -1 )
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Finit32 Buffer2: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Fchg32( Request_Buf_Ptr, TA_OPERATION, 0, "GET", 0) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Fchg32 TA_OPERATION: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Fchg32( Request_Buf_Ptr, TA_CLASS, 0, "T_APPQ", 0) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Fchg32 TA_CLASS: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Fchg32( Request_Buf_Ptr, TA_APPQSPACENAME, 0, Queue_Space, 0) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Fchg32 TA_APPQSPACENAME: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Fchg32( Request_Buf_Ptr, TA_APPQNAME, 0, Queue_Name, 0) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Fchg32 TA_APPQNAME: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Fchg32( Request_Buf_Ptr, TA_QMCONFIG, 0, qmconfig, 0) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Fchg32 TA_QMCONFIG: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Fchg32( Request_Buf_Ptr, TA_LMID, 0, lmid, 0) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Fchg32 TA_LMID: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
fldid1 = TA_APPQNAME;
|
||||||
|
if( Fchg32( Request_Buf_Ptr, TA_FILTER, 0, (char *)&fldid1, 0) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Fchg32 TA_FILTER: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( tpcall( IMRD_TMIB_SERVICE, (void *)Request_Buf_Ptr, 0, (char**)&Response_Buf_Ptr, &rlen, 0L) < 0)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Error tpcall: [%s] !", tpstrerror( tperrno));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Fget32( Response_Buf_Ptr, TA_OCCURS, 0, (char *)&nb_occurs, NULL) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Fget32 TA_OCCURS: [%s] !", Fstrerror32( Ferror32));
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( nb_occurs != 0)
|
||||||
|
{
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_Tux_Exist_Queue */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Queue_Space: Queue Space Name */
|
||||||
|
/* Queue_Name: Queue Name */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Queue_Exist( IMRT_Tux_Queue_Space Queue_Space, IMRT_Tux_Queue_Name Queue_Name)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
IMRT_Tux_Buffer *Request_Buffer_Ptr, *Response_Buffer_Ptr;
|
||||||
|
|
||||||
|
|
||||||
|
if( ( status = Queue_Alloc( &Request_Buffer_Ptr)) == IMRS_OK)
|
||||||
|
{
|
||||||
|
if( ( status = Queue_Alloc( &Response_Buffer_Ptr)) == IMRS_OK)
|
||||||
|
{
|
||||||
|
status = Queue_Exist_Mib( Queue_Space, Queue_Name, Request_Buffer_Ptr, Response_Buffer_Ptr);
|
||||||
|
|
||||||
|
Queue_Free( Response_Buffer_Ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
Queue_Free( Request_Buffer_Ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return( status);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_Tux_Begin */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Medium *Medium_Ptr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_Tux_Begin( IMRT_Medium *Medium_Ptr)
|
||||||
|
{
|
||||||
|
long flags ;
|
||||||
|
IMRT_Status status;
|
||||||
|
|
||||||
|
flags = 0;
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
|
||||||
|
if(IMRG_HDL_TUX_MODE == IMRD_HDL_TUX_NOT_IN_TRANS)
|
||||||
|
{
|
||||||
|
if( tpbegin(IMRD_HDL_TUX_TIME_OUT,flags) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Tpbegin error: [%s] !", tpstrerror(tperrno));
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRG_HDL_TUX_MODE = IMRD_HDL_TUX_IN_TRANS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(status);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_Tux_Commit */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Medium *Medium_Ptr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
IMRT_Status IO_Hdl_Tux_Commit( IMRT_Medium *Medium_Ptr)
|
||||||
|
{
|
||||||
|
long flags ;
|
||||||
|
IMRT_Status status;
|
||||||
|
|
||||||
|
flags = 0;
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if(IMRG_HDL_TUX_MODE == IMRD_HDL_TUX_IN_TRANS)
|
||||||
|
{
|
||||||
|
if( tpcommit(flags) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Tpcommit error: [%s] !", tpstrerror(tperrno));
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRG_HDL_TUX_MODE = IMRD_HDL_TUX_NOT_IN_TRANS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(status);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_Tux_Rollback */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Medium *Medium_Ptr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
IMRT_Status IO_Hdl_Tux_Rollback( IMRT_Medium *Medium_Ptr)
|
||||||
|
{
|
||||||
|
long flags ;
|
||||||
|
IMRT_Status status;
|
||||||
|
|
||||||
|
flags = 0;
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if(IMRG_HDL_TUX_MODE == IMRD_HDL_TUX_IN_TRANS)
|
||||||
|
{
|
||||||
|
if( tpabort(flags) == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Tabort error: [%s] !", tpstrerror(tperrno));
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRG_HDL_TUX_MODE = IMRD_HDL_TUX_NOT_IN_TRANS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(status);
|
||||||
|
|
||||||
|
}
|
171
src/libio_mng/src/io_hdl_tux.h
Normal file
171
src/libio_mng/src/io_hdl_tux.h
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: io_hdl_tux.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _IO_HDL_TUX_H_
|
||||||
|
#define _IO_HDL_TUX_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <libio_mng.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Defines */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_FML_TYPE_32 "FML32"
|
||||||
|
#define IMRD_TMIB_SERVICE ".TMIB"
|
||||||
|
#define IMRD_HDL_TUX_TIME_OUT 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_HDL_TUX_TRAN_MODE ;
|
||||||
|
|
||||||
|
#define IMRD_HDL_TUX_IN_TRANS (IMRT_HDL_TUX_TRAN_MODE)1
|
||||||
|
#define IMRD_HDL_TUX_NOT_IN_TRANS (IMRT_HDL_TUX_TRAN_MODE)0
|
||||||
|
|
||||||
|
# ifdef _IO_HDL_TUX_C_
|
||||||
|
|
||||||
|
IMRT_HDL_TUX_TRAN_MODE IMRG_HDL_TUX_MODE = IMRD_HDL_TUX_NOT_IN_TRANS ;
|
||||||
|
|
||||||
|
# endif /* _IO_HDL_TUX_C_ */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _IO_HDL_TUX_C_
|
||||||
|
|
||||||
|
IMRT_Status IO_Hdl_Tux_Open( IMRT_Medium *, IMRT_Medium_Path, IMRT_Dir_Id);
|
||||||
|
IMRT_Status IO_Hdl_Tux_Close( IMRT_Medium *);
|
||||||
|
IMRT_Status IO_Hdl_Tux_Read( IMRT_Buffer *, size_t *, IMRT_Medium *, IMRT_Read_Mode);
|
||||||
|
IMRT_Status IO_Hdl_Tux_Write( IMRT_Medium *, size_t *, IMRT_Buffer *);
|
||||||
|
IMRT_Status Queue_Alloc( IMRT_Tux_Buffer **);
|
||||||
|
IMRT_Status Queue_Free( IMRT_Tux_Buffer *);
|
||||||
|
IMRT_Status Queue_Exist_Mib( IMRT_Tux_Queue_Space , IMRT_Tux_Queue_Name , IMRT_Tux_Buffer *, IMRT_Tux_Buffer *);
|
||||||
|
IMRT_Status Queue_Exist( IMRT_Tux_Queue_Space , IMRT_Tux_Queue_Name);
|
||||||
|
IMRT_Status IO_Hdl_Tux_Begin( IMRT_Medium *Medium_Ptr);
|
||||||
|
IMRT_Status IO_Hdl_Tux_Commit( IMRT_Medium *Medium_Ptr);
|
||||||
|
IMRT_Status IO_Hdl_Tux_Rollback( IMRT_Medium *Medium_Ptr);
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_Tux_Open */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to open */
|
||||||
|
/* Medium_Path: Medium Path to open */
|
||||||
|
/* Dir_Id: Medium open direction */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern IMRT_Status IO_Hdl_Tux_Open( IMRT_Medium *, IMRT_Medium_Path, IMRT_Dir_Id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_Tux_Close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern IMRT_Status IO_Hdl_Tux_Close( IMRT_Medium *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_Tux_Read */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer_Ptr: Buffer to write data in */
|
||||||
|
/* Read_Len_Ptr: Number of byte writen */
|
||||||
|
/* Medium_Path: Medium to read */
|
||||||
|
/* Read_Mode: Read mode */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern IMRT_Status IO_Hdl_Tux_Read( IMRT_Buffer *, size_t *, IMRT_Medium *, IMRT_Read_Mode);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_Tux_Write */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium towrite data to */
|
||||||
|
/* Write_Len_Ptr: Number of byte writen */
|
||||||
|
/* Buffer_Ptr: Buffer to read */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
extern IMRT_Status IO_Hdl_Tux_Write( IMRT_Medium *, size_t *, IMRT_Buffer *);
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_Tux_Begin */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Medium *Medium_Ptr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
extern IMRT_Status IO_Hdl_Tux_Begin( IMRT_Medium *Medium_Ptr);
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_Tux_Commit */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Medium *Medium_Ptr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
extern IMRT_Status IO_Hdl_Tux_Commit( IMRT_Medium *Medium_Ptr);
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IO_Hdl_Tux_Rollback */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Medium *Medium_Ptr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
extern IMRT_Status IO_Hdl_Tux_Rollback( IMRT_Medium *Medium_Ptr);
|
||||||
|
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
542
src/libio_mng/src/libio_mng.c
Normal file
542
src/libio_mng/src/libio_mng.c
Normal file
@ -0,0 +1,542 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* $Workfile: libio_mng.c $ */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* $Author: agibert $ */
|
||||||
|
/* $Date: 2008/11/12 02:25:22 $ */
|
||||||
|
/* $Revision: 1.1 $ */
|
||||||
|
/* $Label: $ */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBIO_MNG_
|
||||||
|
#define _LIBIO_MNG_C_
|
||||||
|
|
||||||
|
#include "libio_mng.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* IO Manager API */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Open IO Manager */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Lib_Flag: Setup IOM init mode */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_IOM_Library_Open( IMRT_IOM_Config *Config_Ptr)
|
||||||
|
{
|
||||||
|
if( IMRG_IOM_Module.Lib.Status != IMRD_LIB_STATUS_CLOSED)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0( "Library not closed !");
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRG_IOM_Module.Lib.Status = IMRD_LIB_STATUS_OPENED;
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_1, "Library opened !");
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Close IO Manager */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_IOM_Library_Close()
|
||||||
|
{
|
||||||
|
if( IMRG_IOM_Module.Lib.Status != IMRD_LIB_STATUS_OPENED)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0( "Library not opened !");
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRG_IOM_Module.Lib.Status = IMRD_LIB_STATUS_CLOSED;
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_1, "Library closed !");
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Parse Medium URL */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Hdl_Name: Handler name parsed */
|
||||||
|
/* Medium_Path: Medium path parsed */
|
||||||
|
/* Medium_URL: Medium URL to parse */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IOM_URL_Parse( IMRT_IO_Hdl_Name Hdl_Name, IMRT_Medium_Path Medium_Path, IMRT_Medium_URL Medium_URL)
|
||||||
|
{
|
||||||
|
char *ptr;
|
||||||
|
|
||||||
|
|
||||||
|
if( ( ( ptr = strstr( Medium_URL, "://")) == NULL) || ( ptr == Medium_URL) || ( ( ptr - Medium_URL + 3) == strlen( Medium_URL)))
|
||||||
|
{
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
strncpy( Hdl_Name, Medium_URL, ( ptr - Medium_URL));
|
||||||
|
Hdl_Name[ ptr - Medium_URL] = '\0';
|
||||||
|
|
||||||
|
strcpy( Medium_Path, ( ptr + 3));
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Get Medium Type from Handler Name */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Type_Ptr: Medium type to return */
|
||||||
|
/* Handler_Name: IO Handler Name */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IOM_Medium_Type_Get( IMRT_Medium_Type *Medium_Type_Ptr, IMRT_IO_Hdl_Name Hdl_Name)
|
||||||
|
{
|
||||||
|
IMRT_Medium_Type i;
|
||||||
|
|
||||||
|
|
||||||
|
for( i = 0; ( i < IMRD_IO_HDL_NB) && ( strcmp( IMRG_IOM_Base.IO_Hdl_Tab[i].Name, Hdl_Name) != 0) ; i++);
|
||||||
|
|
||||||
|
if( i < IMRD_IO_HDL_NB)
|
||||||
|
{
|
||||||
|
*Medium_Type_Ptr = i;
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Open Medium */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr_Ptr: Reference to the Pointer to the opened medium */
|
||||||
|
/* Medium_Name: Name of the medium */
|
||||||
|
/* Medium_URL: Medium URL to open */
|
||||||
|
/* Appl_Id_Input: Input application Id link with the medium */
|
||||||
|
/* Appl_Id_Output: Output application Id link with the medium */
|
||||||
|
/* Dir_Id: Medium open direction */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_IOM_Medium_Open( IMRT_Medium **Medium_Ptr_Ptr, IMRT_Medium_Name Medium_Name, IMRT_Medium_URL Medium_URL, IMRT_Appl_Id Appl_Id_Input, IMRT_Appl_Id Appl_Id_Output, IMRT_Dir_Id Dir_Id)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
IMRT_IO_Hdl_Name hdl_name;
|
||||||
|
IMRT_Medium_Path medium_path;
|
||||||
|
IMRT_Medium_Type medium_type;
|
||||||
|
|
||||||
|
|
||||||
|
if( ( status = IOM_URL_Parse( hdl_name, medium_path, Medium_URL)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't parse URL [%s] !", Medium_URL);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ( status = IOM_Medium_Type_Get( &medium_type, hdl_name)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't get medium type [%s] !", hdl_name);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ( *Medium_Ptr_Ptr = malloc( sizeof( IMRT_Medium))) == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "Can't allocate Medium [%s]: (%d) !", Medium_Name, errno);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
strcpy( ( *Medium_Ptr_Ptr)->Name, Medium_Name);
|
||||||
|
( *Medium_Ptr_Ptr)->Type = medium_type;
|
||||||
|
( *Medium_Ptr_Ptr)->Status = IMRD_MEDIUM_STATUS_CLOSED;
|
||||||
|
strcpy( ( *Medium_Ptr_Ptr)->URL, Medium_URL);
|
||||||
|
( *Medium_Ptr_Ptr)->Appl_Id_Input = Appl_Id_Input;
|
||||||
|
( *Medium_Ptr_Ptr)->Appl_Id_Output = Appl_Id_Output;
|
||||||
|
( *Medium_Ptr_Ptr)->Dir_Id = Dir_Id;
|
||||||
|
( *Medium_Ptr_Ptr)->Tran_Flag = IMRD_MEDIUM_TRAN_FLAG_OUT;
|
||||||
|
( *Medium_Ptr_Ptr)->Byte_Nb = 0;
|
||||||
|
( *Medium_Ptr_Ptr)->Msg_Nb = 0;
|
||||||
|
|
||||||
|
|
||||||
|
if( IMRG_IOM_Base.IO_Hdl_Tab[ medium_type].Open_Ptr( *Medium_Ptr_Ptr, medium_path, Dir_Id) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't open Medium [%s] !", Medium_Name);
|
||||||
|
free( *Medium_Ptr_Ptr);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
( *Medium_Ptr_Ptr)->Status = IMRD_MEDIUM_STATUS_OPENED;
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Close Medium */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to close */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_IOM_Medium_Close( IMRT_Medium *Medium_Ptr)
|
||||||
|
{
|
||||||
|
if( Medium_Ptr->Status == IMRD_MEDIUM_STATUS_OPENED)
|
||||||
|
{
|
||||||
|
if( IMRG_IOM_Base.IO_Hdl_Tab[ Medium_Ptr->Type].Close_Ptr( Medium_Ptr) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0( "Can't close Medium !");
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRD_LM_LOG_INFO_4( "Medium [%s]: (%d) bytes %s in (%d) messages.", Medium_Ptr->Name, Medium_Ptr->Byte_Nb, ( ( Medium_Ptr->Dir_Id == IMRD_DIR_ID_IN) ? "read" : "writen"), Medium_Ptr->Msg_Nb);
|
||||||
|
|
||||||
|
free( Medium_Ptr);
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Read Medium */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer_Ptr: Pointer to the buffer to write */
|
||||||
|
/* Medium_Ptr: Pointer to the medium to read */
|
||||||
|
/* Read_Mode: Read mode */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_IOM_Medium_Read( IMRT_Buffer *Buffer_Ptr, IMRT_Medium *Medium_Ptr, IMRT_Read_Mode Read_Mode)
|
||||||
|
{
|
||||||
|
size_t read_len;
|
||||||
|
IMRT_Status status;
|
||||||
|
|
||||||
|
|
||||||
|
if( Medium_Ptr->Status == IMRD_MEDIUM_STATUS_OPENED)
|
||||||
|
{
|
||||||
|
if( ( status = IMRG_IOM_Base.IO_Hdl_Tab[ Medium_Ptr->Type].Read_Ptr( Buffer_Ptr, &read_len, Medium_Ptr, Read_Mode)) == IMRS_KO)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't read Medium [%s] !", Medium_Ptr->Name);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( status == IMRS_OK)
|
||||||
|
{
|
||||||
|
Medium_Ptr->Byte_Nb += read_len;
|
||||||
|
Medium_Ptr->Msg_Nb++;
|
||||||
|
|
||||||
|
Buffer_Ptr->Appl_Id_Input = Medium_Ptr->Appl_Id_Input;
|
||||||
|
Buffer_Ptr->Appl_Id_Output = Medium_Ptr->Appl_Id_Output;
|
||||||
|
Buffer_Ptr->Dir_Id = Medium_Ptr->Dir_Id;
|
||||||
|
Buffer_Ptr->Flag = IMRD_BUFFER_FLAG_CLOSED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't read closed Medium [%s] !", Medium_Ptr->Name);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
return( status);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Write Medium */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_Ptr: Pointer to the medium to write */
|
||||||
|
/* Buffer_Ptr: Pointer to the buffer to read */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_IOM_Medium_Write( IMRT_Medium *Medium_Ptr, IMRT_Buffer *Buffer_Ptr)
|
||||||
|
{
|
||||||
|
size_t write_len;
|
||||||
|
|
||||||
|
|
||||||
|
if( Medium_Ptr->Status == IMRD_MEDIUM_STATUS_OPENED)
|
||||||
|
{
|
||||||
|
if( IMRG_IOM_Base.IO_Hdl_Tab[ Medium_Ptr->Type].Write_Ptr( Medium_Ptr, &write_len, Buffer_Ptr) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't write Medium [%s]!", Medium_Ptr->Name);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
Medium_Ptr->Byte_Nb += write_len;
|
||||||
|
Medium_Ptr->Msg_Nb++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't write closed Medium [%s]!", Medium_Ptr->Name);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Tran Begin */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Tran_Ptr_Ptr: Reference to the pointer of the transaction to begin */
|
||||||
|
/* Medium_Count: Number of medium to enclose into the transaction */
|
||||||
|
/* Medium_1_Ptr: Pointer to the first medium */
|
||||||
|
/* ... */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_IOM_Tran_Begin( IMRT_Tran **Tran_Ptr_Ptr, IMRT_Medium_Nb Medium_Nb, IMRT_Medium *Medium_1_Ptr, ...)
|
||||||
|
{
|
||||||
|
int index;
|
||||||
|
va_list medium_list;
|
||||||
|
IMRT_Medium *medium_ptr;
|
||||||
|
IMRT_Status status;
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
medium_ptr = NULL;
|
||||||
|
|
||||||
|
if( Medium_Nb != 0)
|
||||||
|
{
|
||||||
|
va_start( medium_list, Medium_1_Ptr);
|
||||||
|
|
||||||
|
|
||||||
|
if( ( *Tran_Ptr_Ptr = (IMRT_Tran *)malloc( sizeof( IMRT_Tran))) == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't malloc Tran: (%d) !", errno);
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ( (*Tran_Ptr_Ptr)->Medium_Ptr_Tab = (IMRT_Medium **)malloc( sizeof(IMRT_Medium **) * Medium_Nb)) == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't malloc Tran Medium_Ptr_Tab: (%d) !", errno);
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
(*Tran_Ptr_Ptr)->Medium_Nb = Medium_Nb;
|
||||||
|
|
||||||
|
for( index = 0; index < Medium_Nb; index++)
|
||||||
|
{
|
||||||
|
if( index == 0)
|
||||||
|
{
|
||||||
|
( ( *Tran_Ptr_Ptr)->Medium_Ptr_Tab)[index] = Medium_1_Ptr;
|
||||||
|
|
||||||
|
medium_ptr = Medium_1_Ptr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
medium_ptr = (IMRT_Medium *)va_arg( medium_list, IMRT_Medium *);
|
||||||
|
if( medium_ptr != NULL)
|
||||||
|
{
|
||||||
|
(*Tran_Ptr_Ptr)->Medium_Ptr_Tab[index] = medium_ptr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0( "Can't get medium !");
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( status == IMRS_OK)
|
||||||
|
{
|
||||||
|
status = IMRG_IOM_Base.IO_Hdl_Tab[medium_ptr->Type].Begin_Ptr( medium_ptr);
|
||||||
|
|
||||||
|
if( status != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Begin failed for Medium [%s] !", medium_ptr->Name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
(*Tran_Ptr_Ptr)->Medium_Ptr_Tab[index]->Tran_Flag = IMRD_MEDIUM_TRAN_FLAG_IN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
va_end( medium_list);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "BEGIN : Invalid number of medium (%d) !",Medium_Nb );
|
||||||
|
status = IMRS_KO ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return( status);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Tran Commit */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Tran_Ptr: Pointer to the transaction to commit */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_IOM_Tran_Commit( IMRT_Tran *Tran_Ptr)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
int index;
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_1( IMRD_LOG_LEVEL_VERBOSE_1, "Medium Nb to commit: (%d)", Tran_Ptr->Medium_Nb );
|
||||||
|
|
||||||
|
for( index = 0; index < Tran_Ptr->Medium_Nb; index++)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_2( IMRD_LOG_LEVEL_VERBOSE_1, "Medium [%s] Tran_Flag: (%d)", Tran_Ptr->Medium_Ptr_Tab[index]->Name, Tran_Ptr->Medium_Ptr_Tab[index]->Tran_Flag);
|
||||||
|
|
||||||
|
if( Tran_Ptr->Medium_Ptr_Tab[index]->Tran_Flag == IMRD_MEDIUM_TRAN_FLAG_IN)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_1( IMRD_LOG_LEVEL_VERBOSE_1, "Commiting medium [%s]...",Tran_Ptr->Medium_Ptr_Tab[index]->Name);
|
||||||
|
|
||||||
|
status = IMRG_IOM_Base.IO_Hdl_Tab[Tran_Ptr->Medium_Ptr_Tab[index]->Type].Commit_Ptr(Tran_Ptr->Medium_Ptr_Tab[index]);
|
||||||
|
|
||||||
|
if( status == IMRS_OK)
|
||||||
|
{
|
||||||
|
Tran_Ptr->Medium_Ptr_Tab[index]->Tran_Flag = IMRD_MEDIUM_TRAN_FLAG_OUT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Commit failed for medium [%s] !", Tran_Ptr->Medium_Ptr_Tab[index]->Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Tran_Ptr->Medium_Ptr_Tab != NULL)
|
||||||
|
{
|
||||||
|
free( Tran_Ptr->Medium_Ptr_Tab);
|
||||||
|
}
|
||||||
|
|
||||||
|
free( Tran_Ptr);
|
||||||
|
|
||||||
|
return( status);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Tran Rollback */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Tran_Ptr: Pointer to the transaction to rollback */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_IOM_Tran_Rollback( IMRT_Tran *Tran_Ptr)
|
||||||
|
{
|
||||||
|
|
||||||
|
IMRT_Status status;
|
||||||
|
int index;
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_1( IMRD_LOG_LEVEL_VERBOSE_1, "Medium Nb to rollback: (%d)", Tran_Ptr->Medium_Nb );
|
||||||
|
|
||||||
|
for( index = 0; index < Tran_Ptr->Medium_Nb; index++)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_2( IMRD_LOG_LEVEL_VERBOSE_1, "Medium [%s] Tran_Flag: (%d)", Tran_Ptr->Medium_Ptr_Tab[index]->Name, Tran_Ptr->Medium_Ptr_Tab[index]->Tran_Flag);
|
||||||
|
|
||||||
|
if( Tran_Ptr->Medium_Ptr_Tab[index]->Tran_Flag == IMRD_MEDIUM_TRAN_FLAG_IN)
|
||||||
|
{
|
||||||
|
status = IMRG_IOM_Base.IO_Hdl_Tab[Tran_Ptr->Medium_Ptr_Tab[index]->Type].Rollback_Ptr(Tran_Ptr->Medium_Ptr_Tab[index]);
|
||||||
|
|
||||||
|
if(status == IMRS_OK)
|
||||||
|
{
|
||||||
|
Tran_Ptr->Medium_Ptr_Tab[index]->Tran_Flag = IMRD_MEDIUM_TRAN_FLAG_OUT;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Rollback failed for medium [%s] !", Tran_Ptr->Medium_Ptr_Tab[index]->Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Tran_Ptr->Medium_Ptr_Tab != NULL)
|
||||||
|
{
|
||||||
|
free( Tran_Ptr->Medium_Ptr_Tab);
|
||||||
|
}
|
||||||
|
|
||||||
|
free( Tran_Ptr);
|
||||||
|
|
||||||
|
return( status);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
194
src/libio_mng/src/libio_mng.h
Normal file
194
src/libio_mng/src/libio_mng.h
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: libio_mng.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _LIBIO_MNG_H_
|
||||||
|
#define _LIBIO_MNG_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <imr.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Lib Definitions */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_IOM_MODULE_ID ( IMRT_Module_Id) 3
|
||||||
|
#define IMRD_IOM_MODULE_NAME ( IMRT_Module_Name) "iom"
|
||||||
|
#define IMRD_IOM_MODULE_NAME_LONG ( IMRT_Module_Name_Long) "IO Manager"
|
||||||
|
#define IMRD_IOM_MODULE_VERSION ( IMRT_Module_Version) "@(#) VERSIONIMR: $Label: $ $Date: 2008/11/12 02:25:22 $ $Workfile: libio_mng.h $"
|
||||||
|
|
||||||
|
#define IMRD_MODULE_PTR &IMRG_IOM_Module
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local Definitions */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_IO_HDL_NAME_LEN (short) 255
|
||||||
|
#define IMRD_IO_HDL_NAME_SIZE (short) ( IMRD_IO_HDL_NAME_LEN + 1)
|
||||||
|
|
||||||
|
typedef char IMRT_IO_Hdl_Name[ IMRD_IO_HDL_NAME_SIZE];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef IMRT_Status ( IMRT_IO_Hdl_Open) ( IMRT_Medium *, IMRT_Medium_Path, IMRT_Dir_Id);
|
||||||
|
typedef IMRT_Status ( IMRT_IO_Hdl_Close)( IMRT_Medium *);
|
||||||
|
typedef IMRT_Status ( IMRT_IO_Hdl_Read) ( IMRT_Buffer *, size_t *, IMRT_Medium *, IMRT_Read_Mode);
|
||||||
|
typedef IMRT_Status ( IMRT_IO_Hdl_Write)( IMRT_Medium *, size_t *, IMRT_Buffer *);
|
||||||
|
typedef IMRT_Status ( IMRT_IO_Hdl_Begin) ( IMRT_Medium *);
|
||||||
|
typedef IMRT_Status ( IMRT_IO_Hdl_Commit) ( IMRT_Medium *);
|
||||||
|
typedef IMRT_Status ( IMRT_IO_Hdl_Rollback)( IMRT_Medium *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_IO_Hdl
|
||||||
|
{
|
||||||
|
IMRT_IO_Hdl_Name Name;
|
||||||
|
IMRT_IO_Hdl_Open *Open_Ptr;
|
||||||
|
IMRT_IO_Hdl_Close *Close_Ptr;
|
||||||
|
IMRT_IO_Hdl_Read *Read_Ptr;
|
||||||
|
IMRT_IO_Hdl_Write *Write_Ptr;
|
||||||
|
IMRT_IO_Hdl_Begin *Begin_Ptr;
|
||||||
|
IMRT_IO_Hdl_Commit *Commit_Ptr;
|
||||||
|
IMRT_IO_Hdl_Rollback *Rollback_Ptr;
|
||||||
|
|
||||||
|
|
||||||
|
} IMRT_IO_Hdl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_IO_Hdl_Nb;
|
||||||
|
|
||||||
|
#define IMRD_IO_HDL_NB ( IMRT_IO_Hdl_Nb) 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_IO_Base
|
||||||
|
{
|
||||||
|
IMRT_IO_Hdl IO_Hdl_Tab[ IMRD_IO_HDL_NB];
|
||||||
|
} IMRT_IO_Base;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBIO_MNG_C_
|
||||||
|
|
||||||
|
IMRT_Status IOM_URL_Parse( IMRT_IO_Hdl_Name, IMRT_Medium_Path, IMRT_Medium_URL);
|
||||||
|
IMRT_Status IOM_Medium_Type_Get( IMRT_Medium_Type *, IMRT_IO_Hdl_Name);
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local Includes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "io_hdl_file.h"
|
||||||
|
|
||||||
|
#ifdef TUX_SUPPORT
|
||||||
|
# include "io_hdl_tux.h"
|
||||||
|
#endif /* TUX_SUPPORT */
|
||||||
|
|
||||||
|
#ifdef MQS_SUPPORT
|
||||||
|
# include "io_hdl_mqs.h"
|
||||||
|
#endif /* MQS_SUPPORT */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBIO_MNG_C_
|
||||||
|
|
||||||
|
IMRT_IO_Base IMRG_IOM_Base =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
{ "Unknown", NULL, NULL, NULL, NULL, NULL, NULL, NULL},
|
||||||
|
{ "file", IO_Hdl_File_Open, IO_Hdl_File_Close, IO_Hdl_File_Read, IO_Hdl_File_Write,IO_Hdl_File_Begin,IO_Hdl_File_Commit,IO_Hdl_File_Rollback },
|
||||||
|
|
||||||
|
#ifdef TUX_SUPPORT
|
||||||
|
{ "tux", IO_Hdl_Tux_Open, IO_Hdl_Tux_Close, IO_Hdl_Tux_Read, IO_Hdl_Tux_Write, IO_Hdl_Tux_Begin, IO_Hdl_Tux_Commit, IO_Hdl_Tux_Rollback},
|
||||||
|
#endif /* TUX_SUPPORT */
|
||||||
|
|
||||||
|
#ifdef MQS_SUPPORT
|
||||||
|
{ "mqs", IO_Hdl_MQS_Open, IO_Hdl_MQS_Close, IO_Hdl_MQS_Read, IO_Hdl_MQS_Write, IO_Hdl_MQS_Begin, IO_Hdl_MQS_Commit, IO_Hdl_MQS_Rollback},
|
||||||
|
#endif /* MQS_SUPPORT */
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Module IMRG_IOM_Module =
|
||||||
|
{
|
||||||
|
IMRD_IOM_MODULE_ID,
|
||||||
|
IMRD_IOM_MODULE_NAME,
|
||||||
|
IMRD_IOM_MODULE_NAME_LONG,
|
||||||
|
IMRD_IOM_MODULE_VERSION,
|
||||||
|
IMRD_MODULE_TYPE_LIBRARY,
|
||||||
|
{
|
||||||
|
IMRD_LIB_STATUS_CLOSED,
|
||||||
|
( IMRT_Lib_Open *) &IMR_IOM_Library_Open,
|
||||||
|
( IMRT_Lib_Close *) &IMR_IOM_Library_Close
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
extern IMRT_IO_Base IMRG_IOM_Base;
|
||||||
|
extern IMRT_Module IMRG_IOM_Module;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
397
src/liblog_mng/include/log_mng.h
Normal file
397
src/liblog_mng/include/log_mng.h
Normal file
@ -0,0 +1,397 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: log_mng.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _LOG_MNG_H_
|
||||||
|
#define _LOG_MNG_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <imr.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRD_LM_API definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBLOG_MNG_
|
||||||
|
# define IMRD_LM_API
|
||||||
|
# else
|
||||||
|
# define IMRD_LM_API extern
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Status definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRS_LM_LOG (IMRT_Status) 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Log Type definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_LOG_TYPE_NB (short) 5
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_Log_Type_Id;
|
||||||
|
|
||||||
|
#define IMRD_LOG_TYPE_ID_UNKNOWN (IMRT_Log_Type_Id) 0
|
||||||
|
#define IMRD_LOG_TYPE_ID_TRACE (IMRT_Log_Type_Id) 1
|
||||||
|
#define IMRD_LOG_TYPE_ID_INFO (IMRT_Log_Type_Id) 2
|
||||||
|
#define IMRD_LOG_TYPE_ID_WARNING (IMRT_Log_Type_Id) 3
|
||||||
|
#define IMRD_LOG_TYPE_ID_ERROR (IMRT_Log_Type_Id) 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef char *IMRT_Log_Type_Name;
|
||||||
|
|
||||||
|
#define IMRD_LOG_TYPE_NAME_UNKNOWN (IMRT_Log_Type_Name) "???"
|
||||||
|
#define IMRD_LOG_TYPE_NAME_TRACE (IMRT_Log_Type_Name) "TRA"
|
||||||
|
#define IMRD_LOG_TYPE_NAME_INFO (IMRT_Log_Type_Name) "INF"
|
||||||
|
#define IMRD_LOG_TYPE_NAME_WARNING (IMRT_Log_Type_Name) "WRN"
|
||||||
|
#define IMRD_LOG_TYPE_NAME_ERROR (IMRT_Log_Type_Name) "ERR"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Log Level definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef short IMRT_Log_Level;
|
||||||
|
|
||||||
|
#define IMRD_LOG_LEVEL_UNSET ( IMRT_Log_Level) -1
|
||||||
|
|
||||||
|
#define IMRD_LOG_LEVEL_MIN ( IMRT_Log_Level) 0
|
||||||
|
#define IMRD_LOG_LEVEL_MAX ( IMRT_Log_Level) 999
|
||||||
|
|
||||||
|
#define IMRD_LOG_LEVEL_VERBOSE_0 ( IMRT_Log_Level) 10
|
||||||
|
#define IMRD_LOG_LEVEL_VERBOSE_1 ( IMRT_Log_Level) 20
|
||||||
|
#define IMRD_LOG_LEVEL_VERBOSE_2 ( IMRT_Log_Level) 30
|
||||||
|
|
||||||
|
#define IMRD_LOG_LEVEL_DEFAULT ( IMRT_Log_Level) 10
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_File_Name definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef char *IMRT_File_Name;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Line_Id definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef long IMRT_Line_Id;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Log Fmt definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef char *IMRT_Log_Fmt;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Log_Id_Bit definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef size_t IMRT_Log_Id_Bit_Offset;
|
||||||
|
typedef size_t IMRT_Log_Id_Bit_Size;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Log_Id_Bit
|
||||||
|
{
|
||||||
|
IMRT_Log_Id_Bit_Offset Offset;
|
||||||
|
IMRT_Log_Id_Bit_Size Size;
|
||||||
|
} IMRT_Log_Id_Bit;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Log_Id_Struct definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef short IMRT_Bit_Nb;
|
||||||
|
typedef size_t IMRT_Log_Size;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Log_Id_Struct
|
||||||
|
{
|
||||||
|
IMRT_Bit_Nb Bit_Nb;
|
||||||
|
IMRT_Log_Size Log_Size;
|
||||||
|
IMRT_Log_Id_Bit *Log_Id_Bit_Ptr;
|
||||||
|
} IMRT_Log_Id_Struct;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Log_Msg_Header definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef char *IMRT_Log_Id_Header;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* LM_Config definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct IMRT_LM_Config
|
||||||
|
{
|
||||||
|
IMRT_Path Log_File;
|
||||||
|
IMRT_Module_Id Module_Nb;
|
||||||
|
IMRT_Log_Level Level_Tab[ IMRD_LOG_TYPE_NB][ IMRD_MODULE_NB_MAX];
|
||||||
|
} IMRT_LM_Config;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBLOG_MNG_
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
extern IMRT_Module IMRG_LM_Module;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Log Manager API */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Log Trace Macros */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_LM_LOG_TRACE_0( Level, Fmt) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_TRACE, (Level), IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt)) != IMRS_OK) return( IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_TRACE_1( Level, Fmt, Arg1) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_TRACE, (Level), IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_TRACE_2( Level, Fmt, Arg1, Arg2) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_TRACE, (Level), IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1), (Arg2)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_TRACE_3( Level, Fmt, Arg1, Arg2, Arg3) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_TRACE, (Level), IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1), (Arg2), (Arg3)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_TRACE_4( Level, Fmt, Arg1, Arg2, Arg3, Arg4) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_TRACE, (Level), IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_TRACE_5( Level, Fmt, Arg1, Arg2, Arg3, Arg4, Arg5) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_TRACE, (Level), IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Log Info Macros */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_LM_LOG_INFO_0( Fmt) if(IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_INFO, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt)) != IMRS_OK ) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_INFO_1( Fmt, Arg1) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_INFO, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1)) != IMRS_OK) return(IMRS_KO) ;
|
||||||
|
#define IMRD_LM_LOG_INFO_2( Fmt, Arg1, Arg2) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_INFO, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1), (Arg2)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_INFO_3( Fmt, Arg1, Arg2, Arg3) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_INFO, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1), (Arg2), (Arg3)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_INFO_4( Fmt, Arg1, Arg2, Arg3, Arg4) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_INFO, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_INFO_5( Fmt, Arg1, Arg2, Arg3, Arg4, Arg5) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_INFO, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Log Warning Macros */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_LM_LOG_WARNING_0( Fmt) if(IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_WARNING, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_WARNING_1( Fmt, Arg1) if(IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_WARNING, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_WARNING_2( Fmt, Arg1, Arg2) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_WARNING, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1), (Arg2)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_WARNING_3( Fmt, Arg1, Arg2, Arg3) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_WARNING, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1), (Arg2), (Arg3)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_WARNING_4( Fmt, Arg1, Arg2, Arg3, Arg4) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_WARNING, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_WARNING_5( Fmt, Arg1, Arg2, Arg3, Arg4, Arg5) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_WARNING, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Log Error Macros */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_LM_LOG_ERROR_0( Fmt) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_ERROR, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_ERROR_1( Fmt, Arg1) if(IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_ERROR, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1)) != IMRS_OK) return(IMRS_KO) ;
|
||||||
|
#define IMRD_LM_LOG_ERROR_2( Fmt, Arg1, Arg2) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_ERROR, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1), (Arg2)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_ERROR_3( Fmt, Arg1, Arg2, Arg3) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_ERROR, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1), (Arg2), (Arg3)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_ERROR_4( Fmt, Arg1, Arg2, Arg3, Arg4) if(IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_ERROR, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4)) != IMRS_OK) return(IMRS_KO);
|
||||||
|
#define IMRD_LM_LOG_ERROR_5( Fmt, Arg1, Arg2, Arg3, Arg4, Arg5) if( IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_ERROR, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE, (Fmt), (Arg1), (Arg2), (Arg3), (Arg4), (Arg5)) != IMRS_OK ) return(IMRS_KO);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Exec Trace Macros */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_LM_STREAM_OUT stream_out
|
||||||
|
|
||||||
|
#define IMRD_LM_EXEC_TRACE( Level, Msg_Pre, Func, Msg_Post) \
|
||||||
|
{ \
|
||||||
|
FILE *stream_out; \
|
||||||
|
\
|
||||||
|
\
|
||||||
|
if( IMR_LM_Log_Trigger( IMRD_LOG_TYPE_ID_TRACE, (Level), IMRD_MODULE_PTR) == IMRS_LM_LOG) \
|
||||||
|
{ \
|
||||||
|
stream_out = IMR_LM_Stream_Out_Get(); \
|
||||||
|
\
|
||||||
|
IMR_LM_Log_Write( IMRD_LOG_TYPE_ID_TRACE, (Level), IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_FALSE, (Msg_Pre)); \
|
||||||
|
(Func); \
|
||||||
|
fprintf( stream_out, "%s%s", (Msg_Post), "\n"); \
|
||||||
|
fflush( stream_out); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Log Buffer Id Macro */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_LM_LOG_BUFFER_ID( Buffer_Ptr, Log_Id_Struct_Ptr, Log_Id_Header) if( IMR_LM_Log_Buffer_Id( (Buffer_Ptr), (Log_Id_Struct_Ptr), (Log_Id_Header), IMRD_LOG_TYPE_ID_INFO, IMRD_LOG_LEVEL_DEFAULT, IMRD_MODULE_PTR, __FILE__, __LINE__, IMRD_TRUE) != IMRS_OK) return(IMRS_KO);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Open Log Manager */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* LM_Config_Ptr: Setup LM init mode */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_LM_API IMRT_Status IMR_LM_Library_Open( IMRT_LM_Config *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Close Log Manager */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_LM_API IMRT_Status IMR_LM_Library_Close( void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* LM_Stream_Out_Get */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_LM_API FILE *IMR_LM_Stream_Out_Get( void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* LM_Log_Trigger */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Log_Type_Id: Type id of log */
|
||||||
|
/* Log_Level: Level of log */
|
||||||
|
/* Module_Ptr: Loger module pointer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_LM_API IMRT_Status IMR_LM_Log_Trigger( IMRT_Log_Type_Id, IMRT_Log_Level, IMRT_Module *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* LM_Log_Write */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Log_Type_Id: Type id of log */
|
||||||
|
/* Log_Level: Level of log */
|
||||||
|
/* Module_Ptr: Loger module pointer */
|
||||||
|
/* File_Name: Loger file name */
|
||||||
|
/* Line_Id: Loger line id */
|
||||||
|
/* LF_Flag: Add or not a LF at EOF */
|
||||||
|
/* Log_Fmt: Format string a la printf */
|
||||||
|
/* ...: Optional args */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_LM_API IMRT_Status IMR_LM_Log_Write( IMRT_Log_Type_Id, IMRT_Log_Level, IMRT_Module *, IMRT_File_Name, IMRT_Line_Id, IMRT_Boolean, IMRT_Log_Fmt, ...);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Log_Buffer_Id */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer_Ptr: buffer to identify */
|
||||||
|
/* Log_Id_Struct_Ptr: Log_Id_Heap to use */
|
||||||
|
/* Log_Id_Header_Ptr: message to log as header */
|
||||||
|
/* Log_Type_Id: Type id of log */
|
||||||
|
/* Log_Level: Level of log */
|
||||||
|
/* Module_Ptr: Loger module pointer */
|
||||||
|
/* File_Name: Loger file name */
|
||||||
|
/* Line_Id: Loger line id */
|
||||||
|
/* LF_Flag: Add or not a LF at EOF */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_LM_Log_Buffer_Id( IMRT_Buffer *, IMRT_Log_Id_Struct *, IMRT_Log_Id_Header, IMRT_Log_Type_Id, IMRT_Log_Level, IMRT_Module *, IMRT_File_Name, IMRT_Line_Id, IMRT_Boolean);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
65
src/liblog_mng/src/Makefile
Normal file
65
src/liblog_mng/src/Makefile
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Local Makefile
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Workfile: Makefile $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Author: agibert $
|
||||||
|
# $Date: 2008/11/12 02:25:22 $
|
||||||
|
# $Revision: 1.1 $
|
||||||
|
# $Label: $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# IMR - Interlinking Message Router
|
||||||
|
# Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt)
|
||||||
|
# mailto:arnaud@rx3.net
|
||||||
|
# http://www.rx3.org/dvp/?dvp=imr
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# This file is part of IMR
|
||||||
|
#
|
||||||
|
# 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 2
|
||||||
|
# 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, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Var include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include ../../Makefile_var.mk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Variables
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
TARGET= liblog_mng$(SHLIB_SUFFIX)
|
||||||
|
|
||||||
|
OBJ= liblog_mng.o
|
||||||
|
|
||||||
|
EXTRA_INC=
|
||||||
|
|
||||||
|
EXTRA_LIB=
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Rule include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include ../../Makefile_rule.mk
|
362
src/liblog_mng/src/liblog_mng.c
Normal file
362
src/liblog_mng/src/liblog_mng.c
Normal file
@ -0,0 +1,362 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* $Workfile: liblog_mng.c $ */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* $Author: agibert $ */
|
||||||
|
/* $Date: 2008/11/12 02:25:22 $ */
|
||||||
|
/* $Revision: 1.1 $ */
|
||||||
|
/* $Label: $ */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBLOG_MNG_
|
||||||
|
#define _LIBLOG_MNG_C_
|
||||||
|
|
||||||
|
#include "liblog_mng.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Open Log Manager */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Lib_Flag: Setup IOM init mode */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_LM_Library_Open( IMRT_LM_Config *Config_Ptr)
|
||||||
|
{
|
||||||
|
IMRT_Module_Id module_id;
|
||||||
|
IMRT_Log_Type_Id log_type_id;
|
||||||
|
|
||||||
|
|
||||||
|
if( IMRG_LM_Module.Lib.Status != IMRD_LIB_STATUS_CLOSED)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0( "Library not closed !");
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
strcpy( IMRG_LM_Base.Config.Log_File, Config_Ptr->Log_File);
|
||||||
|
|
||||||
|
if( strcmp( Config_Ptr->Log_File, "-") == 0)
|
||||||
|
{
|
||||||
|
IMRG_LM_Base.Stream_Out = stderr;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( ( IMRG_LM_Base.Stream_Out = fopen( Config_Ptr->Log_File, "a")) == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "Can't open log file [%s] (%d) !", IMRG_LM_Base.Config.Log_File, errno);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IMRG_LM_Base.Config.Module_Nb = Config_Ptr->Module_Nb;
|
||||||
|
|
||||||
|
for( module_id = 0; module_id < IMRG_LM_Base.Config.Module_Nb; module_id++)
|
||||||
|
{
|
||||||
|
for( log_type_id = 0; log_type_id < IMRD_LOG_TYPE_NB; log_type_id++)
|
||||||
|
{
|
||||||
|
IMRG_LM_Base.Config.Level_Tab[ log_type_id][ module_id] = Config_Ptr->Level_Tab[ log_type_id][ module_id];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRG_LM_Module.Lib.Status = IMRD_LIB_STATUS_OPENED;
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_1, "Library opened !");
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Close Log Manager */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_LM_Library_Close()
|
||||||
|
{
|
||||||
|
if( IMRG_LM_Module.Lib.Status != IMRD_LIB_STATUS_OPENED)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0( "Library not opened !");
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( ( IMRG_LM_Base.Stream_Out != stderr) && ( fclose( IMRG_LM_Base.Stream_Out) == EOF))
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2( "Can't close log file [%s] (%d) !", IMRG_LM_Base.Config.Log_File, errno);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRG_LM_Module.Lib.Status = IMRD_LIB_STATUS_CLOSED;
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_1, "Library closed !");
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* LM_Stream_Out_Get */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
FILE *IMR_LM_Stream_Out_Get( void)
|
||||||
|
{
|
||||||
|
if( IMRG_LM_Base.Stream_Out == NULL)
|
||||||
|
{
|
||||||
|
return( stderr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return( IMRG_LM_Base.Stream_Out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* LM_Log_Trigger */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Log_Type_Id: Type id of log */
|
||||||
|
/* Log_Level: Level of log */
|
||||||
|
/* Module_Ptr: Loger module pointer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_LM_Log_Trigger( IMRT_Log_Type_Id Log_Type_Id, IMRT_Log_Level Log_Level, IMRT_Module *Module_Ptr)
|
||||||
|
{
|
||||||
|
FILE *Stream_Out;
|
||||||
|
|
||||||
|
|
||||||
|
Stream_Out = IMR_LM_Stream_Out_Get();
|
||||||
|
|
||||||
|
if( ( Log_Type_Id < 0) || ( Log_Type_Id >= IMRD_LOG_TYPE_NB))
|
||||||
|
{
|
||||||
|
fprintf( Stream_Out, "liblog_mng: %s: Invalid Log_Type_Id (%d) !\n", __FILE__, errno);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( IMRG_LM_Module.Lib.Status == IMRD_LIB_STATUS_OPENED)
|
||||||
|
{
|
||||||
|
if ( IMRG_LM_Base.Config.Level_Tab[ Log_Type_Id][ Module_Ptr->Id] != IMRD_LOG_LEVEL_UNSET)
|
||||||
|
{
|
||||||
|
if( Log_Level > IMRG_LM_Base.Config.Level_Tab[ Log_Type_Id][ Module_Ptr->Id])
|
||||||
|
{
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( Log_Level > IMRG_LM_Base.Config.Level_Tab[ Log_Type_Id][ IMRD_MODULE_ID_UNKNOWN])
|
||||||
|
{
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( Log_Type_Id == IMRD_LOG_TYPE_ID_TRACE)
|
||||||
|
{
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return( IMRS_LM_LOG);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* LM_Log_Write */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Log_Type_Id: Type id of log */
|
||||||
|
/* Log_Level: Level of log */
|
||||||
|
/* Module_Ptr: Loger module pointer */
|
||||||
|
/* File_Name: Loger file name */
|
||||||
|
/* Line_Id: Loger line id */
|
||||||
|
/* LF_Flag: Add or not a LF at EOF */
|
||||||
|
/* Log_Fmt: Format string a la printf */
|
||||||
|
/* ...: Optional args */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_LM_Log_Write( IMRT_Log_Type_Id Log_Type_Id, IMRT_Log_Level Log_Level, IMRT_Module *Module_Ptr, IMRT_File_Name File_Name, IMRT_Line_Id Line_Id, IMRT_Boolean LF_Flag, IMRT_Log_Fmt Log_Fmt, ...)
|
||||||
|
{
|
||||||
|
va_list args;
|
||||||
|
FILE *Stream_Out;
|
||||||
|
IMRT_Status status;
|
||||||
|
char fmt[255];
|
||||||
|
struct timeval cur_timeval;
|
||||||
|
struct tm *tm_ptr;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
|
||||||
|
Stream_Out = IMR_LM_Stream_Out_Get();
|
||||||
|
|
||||||
|
if( ( status = IMR_LM_Log_Trigger( Log_Type_Id, Log_Level, Module_Ptr)) != IMRS_LM_LOG)
|
||||||
|
{
|
||||||
|
return( status);
|
||||||
|
}
|
||||||
|
|
||||||
|
gettimeofday( &cur_timeval, NULL);
|
||||||
|
|
||||||
|
if( ( tm_ptr = localtime( &( cur_timeval.tv_sec))) == NULL)
|
||||||
|
{
|
||||||
|
fprintf( Stream_Out, "liblog_mng: %s: can't convert localtime (%d) !\n", __FILE__, errno);
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
va_start( args, Log_Fmt);
|
||||||
|
|
||||||
|
sprintf( fmt, "%02d/%02d/%02d %02d:%02d:%02d.%04d %3s %03d %-4s %-21s %-4d %s%s",
|
||||||
|
( tm_ptr->tm_year - 100), tm_ptr->tm_mon, tm_ptr->tm_mday, tm_ptr->tm_hour, tm_ptr->tm_min, tm_ptr->tm_sec, ( cur_timeval.tv_usec / 100),
|
||||||
|
IMRG_LM_Base.Log_Type_Tab[ Log_Type_Id], Log_Level, Module_Ptr->Name, File_Name, Line_Id,
|
||||||
|
Log_Fmt,
|
||||||
|
( ( LF_Flag == IMRD_TRUE) ? "\n" : ""));
|
||||||
|
|
||||||
|
rc = vfprintf( Stream_Out, fmt, args);
|
||||||
|
|
||||||
|
if( rc < 0)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "liblog_mng: Can't log messages (%d) !!!\n", errno);
|
||||||
|
ND_Library_StdErr_Set( NULL);
|
||||||
|
return(IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
fflush( Stream_Out);
|
||||||
|
|
||||||
|
va_end( args);
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Log_Buffer_Id */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer_Ptr: buffer to identify */
|
||||||
|
/* Log_Id_Struct_Ptr: Log_Id_Heap to use */
|
||||||
|
/* Log_Id_Header_Ptr: message to log as header */
|
||||||
|
/* Log_Type_Id: Type id of log */
|
||||||
|
/* Log_Level: Level of log */
|
||||||
|
/* Module_Ptr: Loger module pointer */
|
||||||
|
/* File_Name: Loger file name */
|
||||||
|
/* Line_Id: Loger line id */
|
||||||
|
/* LF_Flag: Add or not a LF at EOF */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_LM_Log_Buffer_Id( IMRT_Buffer *Buffer_Ptr, IMRT_Log_Id_Struct *Log_Id_Struct_Ptr, IMRT_Log_Id_Header Log_Id_Header, IMRT_Log_Type_Id Log_Type_Id, IMRT_Log_Level Log_Level, IMRT_Module *Module_Ptr, IMRT_File_Name File_Name, IMRT_Line_Id Line_Id, IMRT_Boolean LF_Flag)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char *log_string, *log_ptr, *buf_ptr;
|
||||||
|
int idx;
|
||||||
|
|
||||||
|
|
||||||
|
if( Log_Id_Struct_Ptr->Bit_Nb > 0 )
|
||||||
|
{
|
||||||
|
if( Log_Id_Struct_Ptr->Log_Id_Bit_Ptr != NULL)
|
||||||
|
{
|
||||||
|
if( Buffer_Ptr->Data_Buf_Ptr != NULL)
|
||||||
|
{
|
||||||
|
/* allocation = taille total des Id + ( deux crochets + un espace entre chaque id ) * le nombre d'Id */
|
||||||
|
|
||||||
|
if( ( log_string = malloc( Log_Id_Struct_Ptr->Log_Size + ( 3 * Log_Id_Struct_Ptr->Bit_Nb) + 1)) != NULL)
|
||||||
|
{
|
||||||
|
for( idx = 0, log_ptr = log_string; idx < Log_Id_Struct_Ptr->Bit_Nb; idx++)
|
||||||
|
{
|
||||||
|
*(log_ptr++) = ' ';
|
||||||
|
*(log_ptr++) = '[';
|
||||||
|
|
||||||
|
for( buf_ptr = Buffer_Ptr->Data_Buf_Ptr + Log_Id_Struct_Ptr->Log_Id_Bit_Ptr[ idx].Offset;
|
||||||
|
( *buf_ptr != '\0') && ( buf_ptr < ( Buffer_Ptr->Data_Buf_Ptr
|
||||||
|
+ Log_Id_Struct_Ptr->Log_Id_Bit_Ptr[ idx].Offset
|
||||||
|
+ Log_Id_Struct_Ptr->Log_Id_Bit_Ptr[ idx].Size));
|
||||||
|
buf_ptr++)
|
||||||
|
{
|
||||||
|
*(log_ptr++) = isprint( *buf_ptr) ? *buf_ptr : '.';
|
||||||
|
}
|
||||||
|
|
||||||
|
*(log_ptr++) = ']';
|
||||||
|
}
|
||||||
|
|
||||||
|
*log_ptr = '\0';
|
||||||
|
|
||||||
|
IMR_LM_Log_Write( Log_Type_Id, Log_Level, Module_Ptr, File_Name, Line_Id, LF_Flag, "%s%s", Log_Id_Header, log_string);
|
||||||
|
|
||||||
|
free( log_string);
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Allocation error ! (%d)", errno);
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0( "Buffer data NULL !");
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0( "Log_Id_Bit_Ptr Null !");
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = IMRS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
return( status);
|
||||||
|
}
|
141
src/liblog_mng/src/liblog_mng.h
Normal file
141
src/liblog_mng/src/liblog_mng.h
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: liblog_mng.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _LIBLOG_MNG_H_
|
||||||
|
#define _LIBLOG_MNG_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <imr.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Lib Definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_LM_MODULE_ID ( IMRT_Module_Id) 1
|
||||||
|
#define IMRD_LM_MODULE_NAME ( IMRT_Module_Name) "lm"
|
||||||
|
#define IMRD_LM_MODULE_NAME_LONG ( IMRT_Module_Name_Long) "Log Manager"
|
||||||
|
#define IMRD_LM_MODULE_VERSION ( IMRT_Module_Version) "@(#) VERSIONIMR: $Label: $ $Date: 2008/11/12 02:25:22 $ $Workfile: liblog_mng.h $"
|
||||||
|
|
||||||
|
#define IMRD_MODULE_PTR &IMRG_LM_Module
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local Definitions */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct IMRT_LM_Base
|
||||||
|
{
|
||||||
|
IMRT_Log_Type_Name Log_Type_Tab[ IMRD_LOG_TYPE_NB];
|
||||||
|
IMRT_LM_Config Config;
|
||||||
|
FILE *Stream_Out;
|
||||||
|
} IMRT_LM_Base;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBLOG_MNG_C_
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local Includes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBLOG_MNG_C_
|
||||||
|
|
||||||
|
IMRT_LM_Base IMRG_LM_Base =
|
||||||
|
{
|
||||||
|
{ IMRD_LOG_TYPE_NAME_UNKNOWN, IMRD_LOG_TYPE_NAME_TRACE, IMRD_LOG_TYPE_NAME_INFO, IMRD_LOG_TYPE_NAME_WARNING, IMRD_LOG_TYPE_NAME_ERROR},
|
||||||
|
{ "", 0, { 0 } },
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Module IMRG_LM_Module =
|
||||||
|
{
|
||||||
|
IMRD_LM_MODULE_ID,
|
||||||
|
IMRD_LM_MODULE_NAME,
|
||||||
|
IMRD_LM_MODULE_NAME_LONG,
|
||||||
|
IMRD_LM_MODULE_VERSION,
|
||||||
|
IMRD_MODULE_TYPE_LIBRARY,
|
||||||
|
{
|
||||||
|
IMRD_LIB_STATUS_CLOSED,
|
||||||
|
( IMRT_Lib_Open *) &IMR_LM_Library_Open,
|
||||||
|
( IMRT_Lib_Close *) &IMR_LM_Library_Close
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
extern IMRT_LM_Base IMRG_LM_Base;
|
||||||
|
extern IMRT_Module IMRG_LM_Module;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
159
src/libmapping_mng/include/mapping_mng.h
Normal file
159
src/libmapping_mng/include/mapping_mng.h
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: mapping_mng.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _MAPPING_MNG_H_
|
||||||
|
#define _MAPPING_MNG_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <imr.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRD_MM_API definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBMAPPING_MNG_C_
|
||||||
|
# define IMRD_MM_API
|
||||||
|
# else
|
||||||
|
# define IMRD_MM_API extern
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* MM_Config definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct IMRT_MM_Config
|
||||||
|
{
|
||||||
|
IMRT_Boolean XML_Format;
|
||||||
|
} IMRT_MM_Config;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBMAPPING_MNG_
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
extern IMRT_Module IMRG_MM_Module;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Mapping Manager API */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Open Mapping Manager */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_MM_API IMRT_Status IMR_MM_Library_Open( IMRT_MM_Config *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Close Mapping Manager */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_MM_API IMRT_Status IMR_MM_Library_Close( void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer allocation */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (O) Buffer_Ptr_Ptr : Buffer pointer pointer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_MM_API IMRT_Status IMR_MM_Buffer_Alloc( IMRT_Buffer **);
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer free */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (IO) Buffer_Ptr_Ptr : Buffer pointer pointer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_MM_API IMRT_Status IMR_MM_Buffer_Free( IMRT_Buffer **);
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer check */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Buffer_Ptr : Buffer pointer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_MM_API IMRT_Status IMR_MM_Buffer_Check (IMRT_Buffer *);
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer list */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Buffer_Ptr : Buffer pointer */
|
||||||
|
/* (I) texte : Text to print */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_MM_API IMRT_Status IMR_MM_Buffer_List( IMRT_Buffer *, char *);
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer mapping */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Output_Buffer_Ptr : Output buffer pointer */
|
||||||
|
/* (I) Input_Buffer_Ptr : Input buffer pointer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_MM_API IMRT_Status IMR_MM_Buffer_Map( IMRT_Buffer *, IMRT_Buffer *);
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
81
src/libmapping_mng/src/Makefile
Normal file
81
src/libmapping_mng/src/Makefile
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Local Makefile
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Workfile: Makefile $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Author: agibert $
|
||||||
|
# $Date: 2008/11/12 02:25:22 $
|
||||||
|
# $Revision: 1.1 $
|
||||||
|
# $Label: $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# IMR - Interlinking Message Router
|
||||||
|
# Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt)
|
||||||
|
# mailto:arnaud@rx3.net
|
||||||
|
# http://www.rx3.org/dvp/?dvp=imr
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# This file is part of IMR
|
||||||
|
#
|
||||||
|
# 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 2
|
||||||
|
# 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, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Var include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include ../../Makefile_var.mk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Variables
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
TARGET= libmapping_mng$(SHLIB_SUFFIX)
|
||||||
|
|
||||||
|
OBJ= libmapping_mng.o \
|
||||||
|
map_scheduler.o \
|
||||||
|
buffer_mng.o \
|
||||||
|
cnv_hdl_pad_right.o \
|
||||||
|
cnv_hdl_pad_left.o \
|
||||||
|
cnv_hdl_pad_num.o \
|
||||||
|
cnv_hdl_strip_right.o \
|
||||||
|
cnv_hdl_strip_left.o \
|
||||||
|
cnv_hdl_cut_right.o \
|
||||||
|
cnv_hdl_strip_num.o \
|
||||||
|
fmt_hdl_fixed.o \
|
||||||
|
fmt_hdl_xml.o \
|
||||||
|
fmt_hdl_dltd.o
|
||||||
|
|
||||||
|
ifeq ($(TUX_SUPPORT),1)
|
||||||
|
OBJ+= fmt_hdl_fml.o
|
||||||
|
endif
|
||||||
|
|
||||||
|
EXTRA_INC=
|
||||||
|
|
||||||
|
EXTRA_LIB=
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Rule include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include ../../Makefile_rule.mk
|
1276
src/libmapping_mng/src/buffer_mng.c
Normal file
1276
src/libmapping_mng/src/buffer_mng.c
Normal file
File diff suppressed because it is too large
Load Diff
175
src/libmapping_mng/src/buffer_mng.h
Normal file
175
src/libmapping_mng/src/buffer_mng.h
Normal file
@ -0,0 +1,175 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: buffer_mng.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _BUFFER_MNG_H_
|
||||||
|
#define _BUFFER_MNG_H_
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include "libmapping_mng.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local Includes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _BUFFER_MNG_C_
|
||||||
|
|
||||||
|
# include "fmt_hdl_fixed.h"
|
||||||
|
# include "fmt_hdl_xml.h"
|
||||||
|
|
||||||
|
# ifdef TUX_SUPPORT
|
||||||
|
# include "fmt_hdl_fml.h"
|
||||||
|
# endif /* TUX_SUPPORT */
|
||||||
|
|
||||||
|
# include "cnv_hdl_pad_right.h"
|
||||||
|
# include "cnv_hdl_pad_left.h"
|
||||||
|
# include "cnv_hdl_strip_right.h"
|
||||||
|
# include "cnv_hdl_strip_left.h"
|
||||||
|
# include "cnv_hdl_cut_right.h"
|
||||||
|
# include "cnv_hdl_strip_num.h"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _BUFFER_MNG_C_
|
||||||
|
|
||||||
|
|
||||||
|
typedef IMRT_Status (IMRT_MM_Fmt_Hdl_Init)( void );
|
||||||
|
typedef IMRT_Status (IMRT_MM_Fmt_Hdl_DeInit)( void );
|
||||||
|
typedef IMRT_Status (IMRT_MM_Fmt_Hdl_Data_Free)( IMRT_Buffer * );
|
||||||
|
typedef IMRT_Status (IMRT_MM_Fmt_Hdl_Ident)( IMRT_Msg_Id *, IMRT_Buffer * );
|
||||||
|
typedef IMRT_Status (IMRT_MM_Fmt_Hdl_Open)( IMRT_Buffer * );
|
||||||
|
typedef IMRT_Status (IMRT_MM_Fmt_Hdl_Close)( IMRT_Buffer * );
|
||||||
|
typedef IMRT_Status (IMRT_MM_Fmt_Hdl_Data_List)( IMRT_Buffer * );
|
||||||
|
typedef IMRT_Status (IMRT_MM_Fmt_Hdl_Copy)( IMRT_Buffer * , IMRT_Buffer * );
|
||||||
|
typedef IMRT_Status (IMRT_MM_Fmt_Hdl_Flush)( IMRT_Buffer * );
|
||||||
|
typedef IMRT_Status (IMRT_MM_Fmt_Hdl_Get)( IMRT_Buffer_Data ** , IMRT_Field * , IMRT_Buffer * , size_t * );
|
||||||
|
typedef IMRT_Status (IMRT_MM_Fmt_Hdl_Cnv)( IMRT_Buffer_Data ** , IMRT_Buffer_Data * , IMRT_Field * , size_t *, IMRT_StrHdl_Cnv_Func * );
|
||||||
|
typedef IMRT_Status (IMRT_MM_Fmt_Hdl_Put)( IMRT_Buffer_Data * , IMRT_Field * , IMRT_Buffer * , size_t );
|
||||||
|
|
||||||
|
typedef struct IMRT_StrHdl_Fmt_Func
|
||||||
|
|
||||||
|
{ IMRT_Fmt_Name Nom;
|
||||||
|
IMRT_MM_Fmt_Hdl_Init *Init_Ptr;
|
||||||
|
IMRT_MM_Fmt_Hdl_DeInit *DeInit_Ptr;
|
||||||
|
IMRT_MM_Fmt_Hdl_Data_Free *Data_Free_Ptr;
|
||||||
|
IMRT_MM_Fmt_Hdl_Ident *Ident_Ptr;
|
||||||
|
IMRT_MM_Fmt_Hdl_Open *Open_Ptr;
|
||||||
|
IMRT_MM_Fmt_Hdl_Close *Close_Ptr;
|
||||||
|
IMRT_MM_Fmt_Hdl_Data_List *Data_List_Ptr;
|
||||||
|
IMRT_MM_Fmt_Hdl_Copy *Copy_Ptr;
|
||||||
|
IMRT_MM_Fmt_Hdl_Flush *Flush_Ptr;
|
||||||
|
IMRT_MM_Fmt_Hdl_Get *Get_Ptr;
|
||||||
|
IMRT_MM_Fmt_Hdl_Cnv *Cnv_Ptr;
|
||||||
|
IMRT_MM_Fmt_Hdl_Put *Put_Ptr;
|
||||||
|
|
||||||
|
} IMRT_StrHdl_Fmt_Func;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _BUFFER_MNG_C_
|
||||||
|
|
||||||
|
void *handle;
|
||||||
|
IMRT_Buffer *IMRG_Input_Buffer_Ptr;
|
||||||
|
IMRT_Buffer *IMRG_Output_Buffer_Ptr;
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_StrHdl_Fmt_Func *IMRG_MM_StrHdl_Fmt_Func_Tab;
|
||||||
|
IMRT_Fmt_Id IMRG_Taille_Fmt_Max;
|
||||||
|
|
||||||
|
IMRT_Cnv_Id IMRG_Taille_Cnv_Max;
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _BUFFER_MNG_C_
|
||||||
|
|
||||||
|
IMRT_Status MM_Buffer_Init ( void );
|
||||||
|
IMRT_Status MM_Buffer_DeInit ( void );
|
||||||
|
IMRT_Status IMR_MM_Fmt_Add ( IMRT_Fmt_Id , IMRT_Fmt_Name , IMRT_Fmt_Id );
|
||||||
|
IMRT_Status IMR_MM_Cnv_Add ( IMRT_Cnv_Id , IMRT_Cnv_Name , IMRT_Cnv_Id );
|
||||||
|
IMRT_Status MM_Buffer_List ( IMRT_Buffer * , char * );
|
||||||
|
IMRT_Status MM_Buffer_Alloc ( IMRT_Buffer ** );
|
||||||
|
IMRT_Status MM_Buffer_Free ( IMRT_Buffer ** );
|
||||||
|
IMRT_Status MM_Buffer_Clear ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Buffer_Ident ( IMRT_Msg_Id , IMRT_Buffer *);
|
||||||
|
IMRT_Status MM_Buffer_Open ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Buffer_Close ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Buffer_Copy ( IMRT_Buffer * , IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Buffer_Map ( IMRT_Buffer * , IMRT_Buffer * , IMRT_MsgMap * );
|
||||||
|
IMRT_Status MM_Buffer_Ident_Update ( IMRT_Buffer * , IMRT_Fmt_Id , IMRT_FmtAttr_Value , IMRT_Msg_Id );
|
||||||
|
IMRT_Status Buffer_Application_Check( IMRT_Appl_Id );
|
||||||
|
IMRT_Status Buffer_Direction_Check ( IMRT_Dir_Id );
|
||||||
|
IMRT_Status Buffer_Format_Check ( IMRT_Fmt_Id );
|
||||||
|
IMRT_Status Buffer_Statut_Check ( IMRT_Buffer_Status );
|
||||||
|
IMRT_Status Buffer_Etat_Check ( IMRT_Buffer_Flag );
|
||||||
|
IMRT_Status MM_Buffer_Check ( IMRT_Buffer * );
|
||||||
|
IMRT_Status Buffer_Data_Free ( IMRT_Buffer * );
|
||||||
|
IMRT_Status IMR_MM_Buffer_FieldMap ( IMRT_Field * , IMRT_Field * );
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
extern IMRT_Status MM_Buffer_Init ( void );
|
||||||
|
extern IMRT_Status MM_Buffer_DeInit ( void );
|
||||||
|
extern IMRT_Status MM_Buffer_List ( IMRT_Buffer * , char * );
|
||||||
|
extern IMRT_Status MM_Buffer_Alloc ( IMRT_Buffer ** );
|
||||||
|
extern IMRT_Status MM_Buffer_Free ( IMRT_Buffer ** );
|
||||||
|
extern IMRT_Status MM_Buffer_Clear ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Buffer_Ident ( IMRT_Msg_Id , IMRT_Buffer *);
|
||||||
|
extern IMRT_Status MM_Buffer_Open ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Buffer_Close ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Buffer_Check ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Buffer_Copy ( IMRT_Buffer * , IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Buffer_Map ( IMRT_Buffer * , IMRT_Buffer * , IMRT_MsgMap * );
|
||||||
|
extern IMRT_Status MM_Buffer_Ident_Update ( IMRT_Buffer * , IMRT_Fmt_Id , IMRT_FmtAttr_Value , IMRT_Msg_Id );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
113
src/libmapping_mng/src/cnv_hdl_cut_right.c
Normal file
113
src/libmapping_mng/src/cnv_hdl_cut_right.c
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: cnv_hdl_cut_right.c */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBMAPPING_MNG_
|
||||||
|
#define _CNV_HANDLER_CUT_RIGHT_C_
|
||||||
|
|
||||||
|
#include "cnv_hdl_cut_right.h"
|
||||||
|
|
||||||
|
IMRT_Status MM_Cut_Right_Init()
|
||||||
|
{
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Cut_Right_DeInit()
|
||||||
|
{
|
||||||
|
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Cut_Right_Convert(IMRT_Buffer_Data *Data_Out_Ptr , IMRT_Buffer_Data *Data_In_Ptr , size_t * Len_Ptr , size_t size , IMRT_Cnv_Attr Cnv_Attr )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
int nb_char_to_rm;
|
||||||
|
int cpt;
|
||||||
|
/*char attr;*/
|
||||||
|
size_t len_tmp;
|
||||||
|
IMRT_Buffer_Data *data_tmp_ptr;
|
||||||
|
char *func_name = "MM_Cut_Right_Convert";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
cpt = 0;
|
||||||
|
|
||||||
|
if (Len_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Len pointer NULL" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else if (Data_In_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Input pointer NULL" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Data_Out_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Output pointer NULL" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
len_tmp = *Len_Ptr ;
|
||||||
|
nb_char_to_rm = atoi(Cnv_Attr);
|
||||||
|
if (len_tmp > size)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field Len > size" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if ((size_t)nb_char_to_rm > len_tmp)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2("Nb of char : (%d) > len (%ld)" , nb_char_to_rm , len_tmp);
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (nb_char_to_rm <= 0)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Nb of char : (%d) Nothing to delete" , nb_char_to_rm);
|
||||||
|
status = IMRD_STATUS_NOTHING_TO_DO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
|
||||||
|
memcpy(Data_Out_Ptr , Data_In_Ptr , (len_tmp - nb_char_to_rm));
|
||||||
|
|
||||||
|
Data_Out_Ptr[(len_tmp - nb_char_to_rm)] = '\0';
|
||||||
|
|
||||||
|
*Len_Ptr = (len_tmp - nb_char_to_rm) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == IMRD_STATUS_NOTHING_TO_DO)
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
return (status);
|
||||||
|
}
|
||||||
|
|
59
src/libmapping_mng/src/cnv_hdl_cut_right.h
Normal file
59
src/libmapping_mng/src/cnv_hdl_cut_right.h
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: cnv_hdl_cut_right.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _CNV_HANDLER_CUT_RIGHT_H_
|
||||||
|
#define _CNV_HANDLER_CUT_RIGHT_H_
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "libmapping_mng.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _CNV_HANDLER_CUT_RIGHT_C_
|
||||||
|
|
||||||
|
IMRT_Status MM_Cut_Right_Init ( void );
|
||||||
|
IMRT_Status MM_Cut_Right_DeInit ( void );
|
||||||
|
IMRT_Status MM_Cut_Right_Convert( IMRT_Buffer_Data * , IMRT_Buffer_Data * , size_t * , size_t , IMRT_Cnv_Attr );
|
||||||
|
|
||||||
|
#else
|
||||||
|
extern IMRT_Status MM_Cut_Right_Init ( void );
|
||||||
|
extern IMRT_Status MM_Cut_Right_DeInit ( void );
|
||||||
|
extern IMRT_Status MM_Cut_Right_Convert( IMRT_Buffer_Data * , IMRT_Buffer_Data * , size_t * , size_t , IMRT_Cnv_Attr );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
111
src/libmapping_mng/src/cnv_hdl_pad_left.c
Normal file
111
src/libmapping_mng/src/cnv_hdl_pad_left.c
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: cnv_hdl_pad_left.c */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBMAPPING_MNG_
|
||||||
|
#define _CNV_HANDLER_PAD_LEFT_C_
|
||||||
|
|
||||||
|
#include "cnv_hdl_pad_left.h"
|
||||||
|
|
||||||
|
IMRT_Status MM_Pad_Left_Init()
|
||||||
|
{
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Pad_Left_DeInit()
|
||||||
|
{
|
||||||
|
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Pad_Left_Convert(IMRT_Buffer_Data *Data_Out_Ptr , IMRT_Buffer_Data *Data_In_Ptr , size_t * Len_Ptr , size_t size , IMRT_Cnv_Attr Cnv_Attr )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char attr;
|
||||||
|
size_t compteur;
|
||||||
|
size_t len_tmp;
|
||||||
|
size_t offset;
|
||||||
|
IMRT_Buffer_Data *data_tmp_ptr;
|
||||||
|
char *func_name = "MM_Pad_Left_Convert";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
compteur = 0L;
|
||||||
|
offset = 0L;
|
||||||
|
attr = '0';
|
||||||
|
|
||||||
|
len_tmp = *Len_Ptr ;
|
||||||
|
|
||||||
|
if (Len_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Len pointer NULL" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Data_In_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Input pointer NULL" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Data_Out_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Output pointer NULL" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
len_tmp = *Len_Ptr ;
|
||||||
|
if (len_tmp > size)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field Len > size" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
offset = size - len_tmp;
|
||||||
|
|
||||||
|
attr = Cnv_Attr[0];
|
||||||
|
|
||||||
|
memcpy(Data_Out_Ptr + offset , Data_In_Ptr , len_tmp);
|
||||||
|
data_tmp_ptr = Data_Out_Ptr;
|
||||||
|
|
||||||
|
for (compteur = 0L ; compteur < offset ; compteur++)
|
||||||
|
{
|
||||||
|
data_tmp_ptr[compteur] = attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
data_tmp_ptr[size] = '\0';
|
||||||
|
*Len_Ptr = size ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return (status);
|
||||||
|
}
|
||||||
|
|
59
src/libmapping_mng/src/cnv_hdl_pad_left.h
Normal file
59
src/libmapping_mng/src/cnv_hdl_pad_left.h
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: cnv_hdl_pad_left.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _CNV_HANDLER_PAD_LEFT_H_
|
||||||
|
#define _CNV_HANDLER_PAD_LEFT_H_
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "libmapping_mng.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _CNV_HANDLER_PAD_LEFT_C_
|
||||||
|
|
||||||
|
IMRT_Status MM_Pad_Left_Init ( void );
|
||||||
|
IMRT_Status MM_Pad_Left_DeInit ( void );
|
||||||
|
IMRT_Status MM_Pad_Left_Convert( IMRT_Buffer_Data * ,IMRT_Buffer_Data * , size_t * , size_t , IMRT_Cnv_Attr );
|
||||||
|
|
||||||
|
#else
|
||||||
|
extern IMRT_Status MM_Pad_Left_Init ( void );
|
||||||
|
extern IMRT_Status MM_Pad_Left_DeInit ( void );
|
||||||
|
extern IMRT_Status MM_Pad_Left_Convert( IMRT_Buffer_Data * ,IMRT_Buffer_Data * , size_t * , size_t , IMRT_Cnv_Attr );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
81
src/libmapping_mng/src/cnv_hdl_pad_num.c
Normal file
81
src/libmapping_mng/src/cnv_hdl_pad_num.c
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: cnv_hdl_pad_left.c */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBMAPPING_MNG_
|
||||||
|
#define _CNV_HANDLER_PAD_NUM_C_
|
||||||
|
|
||||||
|
#include "cnv_hdl_pad_num.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status MM_Pad_Num_Init()
|
||||||
|
{
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Pad_Num_DeInit()
|
||||||
|
{
|
||||||
|
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Pad_Num_Convert(IMRT_Buffer_Data *Data_Out_Ptr , IMRT_Buffer_Data *Data_In_Ptr , size_t * Len_Ptr , size_t size , IMRT_Cnv_Attr Cnv_Attr )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char attr_space[2] ;
|
||||||
|
char attr_zero[2] ;
|
||||||
|
IMRT_Buffer_Data *Tmp_Ptr;
|
||||||
|
char *func_name = "MM_Pad_Num_Convert";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
strcpy(attr_space , " ");
|
||||||
|
strcpy(attr_zero , "0");
|
||||||
|
|
||||||
|
Tmp_Ptr = (IMRT_Buffer_Data *)malloc(size + 1L);
|
||||||
|
if (Tmp_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Memory allocation failed");
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memset(Tmp_Ptr, '\0', (size + 1L));
|
||||||
|
|
||||||
|
status = MM_Strip_Num_Convert(Tmp_Ptr , Data_In_Ptr , Len_Ptr , size , attr_zero );
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
status = MM_Pad_Left_Convert(Data_Out_Ptr , Tmp_Ptr , Len_Ptr , size , attr_zero );
|
||||||
|
}
|
||||||
|
if (Tmp_Ptr != NULL)
|
||||||
|
free(Tmp_Ptr);
|
||||||
|
|
||||||
|
return (status);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
59
src/libmapping_mng/src/cnv_hdl_pad_num.h
Normal file
59
src/libmapping_mng/src/cnv_hdl_pad_num.h
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: cnv_hdl_pad_left.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _CNV_HANDLER_PAD_NUM_H_
|
||||||
|
#define _CNV_HANDLER_PAD_NUM_H_
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "libmapping_mng.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _CNV_HANDLER_PAD_LEFT_C_
|
||||||
|
|
||||||
|
IMRT_Status MM_Pad_Num_Init ( void );
|
||||||
|
IMRT_Status MM_Pad_Num_DeInit ( void );
|
||||||
|
IMRT_Status MM_Pad_Num_Convert( IMRT_Buffer_Data * ,IMRT_Buffer_Data * , size_t * , size_t , IMRT_Cnv_Attr );
|
||||||
|
|
||||||
|
#else
|
||||||
|
extern IMRT_Status MM_Pad_Num_Init ( void );
|
||||||
|
extern IMRT_Status MM_Pad_Num_DeInit ( void );
|
||||||
|
extern IMRT_Status MM_Pad_Num_Convert( IMRT_Buffer_Data * ,IMRT_Buffer_Data * , size_t * , size_t , IMRT_Cnv_Attr );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
100
src/libmapping_mng/src/cnv_hdl_pad_right.c
Normal file
100
src/libmapping_mng/src/cnv_hdl_pad_right.c
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: cnv_hdl_pad_right.c */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBMAPPING_MNG_
|
||||||
|
#define _CNV_HANDLER_PAD_RIGHT_C_
|
||||||
|
|
||||||
|
#include "cnv_hdl_pad_right.h"
|
||||||
|
|
||||||
|
IMRT_Status MM_Pad_Right_Init()
|
||||||
|
{
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Pad_Right_DeInit()
|
||||||
|
{
|
||||||
|
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status MM_Pad_Right_Convert(IMRT_Buffer_Data *Data_Out_Ptr , IMRT_Buffer_Data *Data_In_Ptr , size_t * Len_Ptr , size_t size , IMRT_Cnv_Attr Cnv_Attr )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char attr;
|
||||||
|
size_t compteur;
|
||||||
|
size_t len_tmp;
|
||||||
|
IMRT_Buffer_Data *data_tmp_ptr;
|
||||||
|
char *func_name = "MM_Pad_Right_Convert";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
compteur = 0L;
|
||||||
|
attr = '0';
|
||||||
|
|
||||||
|
len_tmp = *Len_Ptr ;
|
||||||
|
|
||||||
|
if (len_tmp > size)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field Len > size" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (Data_In_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Input pointer NULL" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Data_Out_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Output pointer NULL" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
attr = Cnv_Attr[0];
|
||||||
|
|
||||||
|
memcpy(Data_Out_Ptr , Data_In_Ptr , len_tmp);
|
||||||
|
data_tmp_ptr = Data_Out_Ptr + len_tmp ;
|
||||||
|
|
||||||
|
for (compteur = 0L ; compteur < (size - len_tmp) ; compteur++)
|
||||||
|
{
|
||||||
|
data_tmp_ptr[compteur] = attr;
|
||||||
|
}
|
||||||
|
|
||||||
|
data_tmp_ptr[compteur] = '\0';
|
||||||
|
*Len_Ptr = size ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return (status);
|
||||||
|
}
|
||||||
|
|
59
src/libmapping_mng/src/cnv_hdl_pad_right.h
Normal file
59
src/libmapping_mng/src/cnv_hdl_pad_right.h
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: cnv_hdl_pad_right.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _CNV_HANDLER_PAD_RIGHT_H_
|
||||||
|
#define _CNV_HANDLER_PAD_RIGHT_H_
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "libmapping_mng.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _CNV_HANDLER_PAD_RIGHT_C_
|
||||||
|
|
||||||
|
IMRT_Status MM_Pad_Right_Init ( void );
|
||||||
|
IMRT_Status MM_Pad_Right_DeInit ( void );
|
||||||
|
IMRT_Status MM_Pad_Right_Convert( IMRT_Buffer_Data * ,IMRT_Buffer_Data * , size_t * , size_t , IMRT_Cnv_Attr );
|
||||||
|
|
||||||
|
#else
|
||||||
|
extern IMRT_Status MM_Pad_Right_Init ( void );
|
||||||
|
extern IMRT_Status MM_Pad_Right_DeInit ( void );
|
||||||
|
extern IMRT_Status MM_Pad_Right_Convert( IMRT_Buffer_Data * ,IMRT_Buffer_Data * , size_t * , size_t , IMRT_Cnv_Attr );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
128
src/libmapping_mng/src/cnv_hdl_strip_left.c
Normal file
128
src/libmapping_mng/src/cnv_hdl_strip_left.c
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: cnv_hdl_strip_left.c */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBMAPPING_MNG_
|
||||||
|
#define _CNV_HANDLER_STRIP_LEFT_C_
|
||||||
|
|
||||||
|
#include "cnv_hdl_strip_left.h"
|
||||||
|
|
||||||
|
IMRT_Status MM_Strip_Left_Init()
|
||||||
|
{
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Strip_Left_DeInit()
|
||||||
|
{
|
||||||
|
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Strip_Left_Convert(IMRT_Buffer_Data *Data_Out_Ptr , IMRT_Buffer_Data *Data_In_Ptr , size_t * Len_Ptr , size_t size , IMRT_Cnv_Attr Cnv_Attr )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char attr;
|
||||||
|
size_t compteur;
|
||||||
|
size_t len_tmp;
|
||||||
|
IMRT_Buffer_Data *data_tmp_ptr;
|
||||||
|
IMRT_Buffer_Data *data_tmp_idx_ptr;
|
||||||
|
char *func_name = "MM_Strip_Left_Convert";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
|
||||||
|
if (Len_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Len pointer NULL" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Data_In_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Input pointer NULL" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Data_Out_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Output pointer NULL" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
len_tmp = *Len_Ptr ;
|
||||||
|
if (len_tmp > size)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field Len > size" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
attr = Cnv_Attr[0];
|
||||||
|
|
||||||
|
data_tmp_ptr = (IMRT_Buffer_Data *)malloc(size + 1L);
|
||||||
|
if(data_tmp_ptr == NULL)
|
||||||
|
{
|
||||||
|
/*erreur allocation */
|
||||||
|
IMRD_LM_LOG_ERROR_0("Memory allocation failed");
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memset( data_tmp_ptr, '\0' , (size + 1L) );
|
||||||
|
data_tmp_idx_ptr = data_tmp_ptr;
|
||||||
|
memcpy(data_tmp_ptr , Data_In_Ptr , len_tmp) ;
|
||||||
|
data_tmp_ptr[len_tmp] = '\0';
|
||||||
|
memset( Data_Out_Ptr, '\0' , (size + 1L) );
|
||||||
|
|
||||||
|
compteur = 0L;
|
||||||
|
|
||||||
|
while ((data_tmp_idx_ptr[0L] == attr) && (compteur < *Len_Ptr))
|
||||||
|
{
|
||||||
|
data_tmp_idx_ptr++;
|
||||||
|
len_tmp--;
|
||||||
|
compteur++;
|
||||||
|
}
|
||||||
|
|
||||||
|
data_tmp_idx_ptr[len_tmp] = '\0';
|
||||||
|
|
||||||
|
memcpy(Data_Out_Ptr , data_tmp_idx_ptr , len_tmp + 1L);
|
||||||
|
|
||||||
|
*Len_Ptr = len_tmp ;
|
||||||
|
|
||||||
|
free(data_tmp_ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return (status);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
59
src/libmapping_mng/src/cnv_hdl_strip_left.h
Normal file
59
src/libmapping_mng/src/cnv_hdl_strip_left.h
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: cnv_hdl_strip_left.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _CNV_HANDLER_STRIP_LEFT_H_
|
||||||
|
#define _CNV_HANDLER_STRIP_LEFT_H_
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "libmapping_mng.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _CNV_HANDLER_STRIP_LEFT_C_
|
||||||
|
|
||||||
|
IMRT_Status MM_Strip_Left_Init ( void );
|
||||||
|
IMRT_Status MM_Strip_Left_DeInit ( void );
|
||||||
|
IMRT_Status MM_Strip_Left_Convert( IMRT_Buffer_Data * , IMRT_Buffer_Data * , size_t * , size_t , IMRT_Cnv_Attr );
|
||||||
|
|
||||||
|
#else
|
||||||
|
extern IMRT_Status MM_Strip_Left_Init ( void );
|
||||||
|
extern IMRT_Status MM_Strip_Left_DeInit ( void );
|
||||||
|
extern IMRT_Status MM_Strip_Left_Convert( IMRT_Buffer_Data * , IMRT_Buffer_Data * , size_t * , size_t , IMRT_Cnv_Attr );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
80
src/libmapping_mng/src/cnv_hdl_strip_num.c
Normal file
80
src/libmapping_mng/src/cnv_hdl_strip_num.c
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: cnv_hdl_strip_num.c */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBMAPPING_MNG_
|
||||||
|
#define _CNV_HANDLER_STRIP_NUM_C_
|
||||||
|
|
||||||
|
#include "cnv_hdl_strip_num.h"
|
||||||
|
|
||||||
|
IMRT_Status MM_Strip_Num_Init()
|
||||||
|
{
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Strip_Num_DeInit()
|
||||||
|
{
|
||||||
|
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Strip_Num_Convert(IMRT_Buffer_Data *Data_Out_Ptr , IMRT_Buffer_Data *Data_In_Ptr , size_t * Len_Ptr , size_t size , IMRT_Cnv_Attr Cnv_Attr )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char attr_space[2] ;
|
||||||
|
char attr_zero[2] ;
|
||||||
|
IMRT_Buffer_Data *Data_Tmp_Ptr;
|
||||||
|
char *func_name = "MM_Strip_Num_Convert";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
strcpy(attr_space , " ");
|
||||||
|
strcpy(attr_zero , "0");
|
||||||
|
|
||||||
|
Data_Tmp_Ptr = (IMRT_Buffer_Data *)malloc(size + 1L);
|
||||||
|
if (Data_Tmp_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Memory allocation failed");
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memset(Data_Tmp_Ptr, '\0', (size + 1L));
|
||||||
|
|
||||||
|
status = MM_Strip_Left_Convert(Data_Tmp_Ptr , Data_In_Ptr , Len_Ptr , size , attr_space );
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
status = MM_Strip_Left_Convert(Data_Out_Ptr , Data_Tmp_Ptr , Len_Ptr , size , attr_zero );
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Data_Tmp_Ptr != NULL)
|
||||||
|
free(Data_Tmp_Ptr);
|
||||||
|
|
||||||
|
return (status);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
59
src/libmapping_mng/src/cnv_hdl_strip_num.h
Normal file
59
src/libmapping_mng/src/cnv_hdl_strip_num.h
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: cnv_hdl_strip_num.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _CNV_HANDLER_STRIP_NUM_H_
|
||||||
|
#define _CNV_HANDLER_STRIP_NUM_H_
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "libmapping_mng.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _CNV_HANDLER_STRIP_NUM_C_
|
||||||
|
|
||||||
|
IMRT_Status MM_Strip_Num_Init ( void );
|
||||||
|
IMRT_Status MM_Strip_Num_DeInit ( void );
|
||||||
|
IMRT_Status MM_Strip_Num_Convert( IMRT_Buffer_Data * , IMRT_Buffer_Data * , size_t * , size_t , IMRT_Cnv_Attr );
|
||||||
|
|
||||||
|
#else
|
||||||
|
extern IMRT_Status MM_Strip_Num_Init ( void );
|
||||||
|
extern IMRT_Status MM_Strip_Num_DeInit ( void );
|
||||||
|
extern IMRT_Status MM_Strip_Num_Convert( IMRT_Buffer_Data * , IMRT_Buffer_Data * , size_t * , size_t , IMRT_Cnv_Attr );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
105
src/libmapping_mng/src/cnv_hdl_strip_right.c
Normal file
105
src/libmapping_mng/src/cnv_hdl_strip_right.c
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: cnv_hdl_strip_right.c */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBMAPPING_MNG_
|
||||||
|
#define _CNV_HANDLER_STRIP_RIGHT_C_
|
||||||
|
|
||||||
|
#include "cnv_hdl_strip_right.h"
|
||||||
|
|
||||||
|
IMRT_Status MM_Strip_Right_Init()
|
||||||
|
{
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Strip_Right_DeInit()
|
||||||
|
{
|
||||||
|
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Strip_Right_Convert(IMRT_Buffer_Data *Data_Out_Ptr , IMRT_Buffer_Data *Data_In_Ptr , size_t * Len_Ptr , size_t size , IMRT_Cnv_Attr Cnv_Attr )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char attr;
|
||||||
|
size_t len_tmp;
|
||||||
|
IMRT_Buffer_Data *data_tmp_ptr;
|
||||||
|
char *func_name = "MM_Strip_Right_Convert";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
|
||||||
|
if (Len_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Len pointer NULL" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Data_In_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Input pointer NULL" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Data_Out_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Output pointer NULL" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
len_tmp = *Len_Ptr ;
|
||||||
|
if (len_tmp > size)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field Len > size" );
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
attr = Cnv_Attr[0];
|
||||||
|
|
||||||
|
data_tmp_ptr = Data_In_Ptr + len_tmp ;
|
||||||
|
|
||||||
|
|
||||||
|
while ((data_tmp_ptr > Data_In_Ptr) && (*(--data_tmp_ptr) == attr) )
|
||||||
|
{
|
||||||
|
len_tmp--;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Data_Out_Ptr != Data_In_Ptr)
|
||||||
|
memcpy(Data_Out_Ptr , Data_In_Ptr , len_tmp);
|
||||||
|
Data_Out_Ptr[len_tmp] = '\0';
|
||||||
|
|
||||||
|
*Len_Ptr = len_tmp ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return (status);
|
||||||
|
}
|
||||||
|
|
59
src/libmapping_mng/src/cnv_hdl_strip_right.h
Normal file
59
src/libmapping_mng/src/cnv_hdl_strip_right.h
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: cnv_hdl_strip_right.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _CNV_HANDLER_STRIP_RIGHT_H_
|
||||||
|
#define _CNV_HANDLER_STRIP_RIGHT_H_
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "libmapping_mng.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _CNV_HANDLER_STRIP_RIGHT_C_
|
||||||
|
|
||||||
|
IMRT_Status MM_Strip_Right_Init ( void );
|
||||||
|
IMRT_Status MM_Strip_Right_DeInit ( void );
|
||||||
|
IMRT_Status MM_Strip_Right_Convert( IMRT_Buffer_Data * , IMRT_Buffer_Data * , size_t * , size_t , IMRT_Cnv_Attr );
|
||||||
|
|
||||||
|
#else
|
||||||
|
extern IMRT_Status MM_Strip_Right_Init ( void );
|
||||||
|
extern IMRT_Status MM_Strip_Right_DeInit ( void );
|
||||||
|
extern IMRT_Status MM_Strip_Right_Convert( IMRT_Buffer_Data * , IMRT_Buffer_Data * , size_t * , size_t , IMRT_Cnv_Attr );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
31
src/libmapping_mng/src/field.tbls.h
Normal file
31
src/libmapping_mng/src/field.tbls.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: field.tbls.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* fname fldid */
|
||||||
|
/* ----- ----- */
|
||||||
|
#define FML_MSG_TXT ((FLDID32)201327012) /* number: 420 type: carray */
|
1079
src/libmapping_mng/src/fmt_hdl_dltd.c
Normal file
1079
src/libmapping_mng/src/fmt_hdl_dltd.c
Normal file
File diff suppressed because it is too large
Load Diff
115
src/libmapping_mng/src/fmt_hdl_dltd.h
Normal file
115
src/libmapping_mng/src/fmt_hdl_dltd.h
Normal file
@ -0,0 +1,115 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: fmt_hdl_dltd.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _DELIMITED_HANDLER_H_
|
||||||
|
#define _DELIMITED_HANDLER_H_
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "libmapping_mng.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _DELIMITED_HANDLER_C_
|
||||||
|
|
||||||
|
# define DELIMITED_TAILLE_ALLOC 100000
|
||||||
|
|
||||||
|
typedef struct IMRT_Delimited_TmpId
|
||||||
|
{
|
||||||
|
IMRT_Delimited_Id TmpId;
|
||||||
|
} IMRT_Delimited_TmpId;
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
#ifdef _DELIMITED_HANDLER_C_
|
||||||
|
|
||||||
|
IMRT_Buffer *IMRG_Delimited_Buffer_Ident_Ptr;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _DELIMITED_HANDLER_C_
|
||||||
|
|
||||||
|
IMRT_Status MM_Delimited_StrHdl_Init ( void );
|
||||||
|
IMRT_Status MM_Delimited_StrHdl_DeInit ( void );
|
||||||
|
IMRT_Status Delimited_Hdl_DataBuf_Alloc ( IMRT_Buffer * , size_t );
|
||||||
|
IMRT_Status MM_Delimited_StrHdl_Data_Free ( IMRT_Buffer * );
|
||||||
|
IMRT_Status Delimited_Hdl_Format_Ident ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Delimited_StrHdl_Ident ( IMRT_Msg_Id * , IMRT_Buffer * );
|
||||||
|
IMRT_Status Delimited_Hdl_Occ_Count ( IMRT_Buffer_Data * , short * , IMRT_FmtAttr_Value );
|
||||||
|
IMRT_Status Delimited_Hdl_TmpId_Init ( IMRT_Buffer * , short );
|
||||||
|
IMRT_Status MM_Delimited_StrHdl_Open ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Delimited_StrHdl_Close ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Delimited_StrHdl_Flush ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Delimited_StrHdl_Flush ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Delimited_StrHdl_Data_List ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Delimited_StrHdl_Copy ( IMRT_Buffer * , IMRT_Buffer * );
|
||||||
|
IMRT_Status Delimited_Hdl_Field_Exist ( IMRT_Field * , IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Delimited_StrHdl_Get ( IMRT_Buffer_Data ** , IMRT_Field * , IMRT_Buffer * , size_t * );
|
||||||
|
IMRT_Status MM_Delimited_StrHdl_Convert ( IMRT_Buffer_Data ** , IMRT_Buffer_Data * , IMRT_Field * , size_t *, IMRT_StrHdl_Cnv_Func * );
|
||||||
|
IMRT_Status MM_Delimited_StrHdl_Put ( IMRT_Buffer_Data * , IMRT_Field * , IMRT_Buffer * , size_t );
|
||||||
|
IMRT_Status IMR_MM_Delimited_StrHdl_Field_Value ( IMRT_Field * , IMRT_Field_Value_Id);
|
||||||
|
IMRT_Status IMR_MM_Delimited_StrHdl_Field_Exist ( IMRT_Field * );
|
||||||
|
IMRT_Status IMR_MM_Delimited_StrHdl_Msg_Size ( size_t );
|
||||||
|
#else
|
||||||
|
|
||||||
|
extern IMRT_Status MM_Delimited_StrHdl_Init ( void );
|
||||||
|
extern IMRT_Status MM_Delimited_StrHdl_DeInit ( void );
|
||||||
|
extern IMRT_Status MM_Delimited_StrHdl_Library_Open ( void );
|
||||||
|
extern IMRT_Status MM_Delimited_StrHdl_Data_Free ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Delimited_StrHdl_Ident ( IMRT_Msg_Id * , IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Delimited_StrHdl_Open ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Delimited_StrHdl_Close ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Delimited_StrHdl_Flush ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Delimited_StrHdl_Flush ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Delimited_StrHdl_Data_List ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Delimited_StrHdl_Copy ( IMRT_Buffer * , IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Delimited_StrHdl_Get ( IMRT_Buffer_Data ** , IMRT_Field * , IMRT_Buffer * , size_t * );
|
||||||
|
extern IMRT_Status MM_Delimited_StrHdl_Convert ( IMRT_Buffer_Data ** , IMRT_Buffer_Data * , IMRT_Field * , size_t *, IMRT_StrHdl_Cnv_Func * );
|
||||||
|
extern IMRT_Status MM_Delimited_StrHdl_Put ( IMRT_Buffer_Data * , IMRT_Field * , IMRT_Buffer * , size_t );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
744
src/libmapping_mng/src/fmt_hdl_fixed.c
Normal file
744
src/libmapping_mng/src/fmt_hdl_fixed.c
Normal file
@ -0,0 +1,744 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: fmt_hdl_fixed.c */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBMAPPING_MNG_
|
||||||
|
#define _FIXED_HANDLER_C_
|
||||||
|
|
||||||
|
#include "fmt_hdl_fixed.h"
|
||||||
|
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Init()
|
||||||
|
{
|
||||||
|
IMRG_Fixed_Buffer_Ident_Ptr = NULL;
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_DeInit()
|
||||||
|
{
|
||||||
|
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
IMRT_Status Fixed_Hdl_DataBuf_Alloc( IMRT_Buffer *Buffer_Ptr, size_t Taille_Alloc )
|
||||||
|
{
|
||||||
|
IMRT_Buffer_Data *data_Ptr;
|
||||||
|
IMRT_Status status;
|
||||||
|
char *func_name = "Fixed_Hdl_DataBuf_Alloc";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
data_Ptr = NULL;
|
||||||
|
|
||||||
|
if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Buffer_Ptr->Status == IMRD_BUFFER_STATUS_ALLOCATED)
|
||||||
|
{
|
||||||
|
if (Taille_Alloc > Buffer_Ptr->Data_Buf_Size)
|
||||||
|
{
|
||||||
|
data_Ptr = (IMRT_Buffer_Data *) realloc ( (void *) Buffer_Ptr->Data_Buf_Ptr, Taille_Alloc );
|
||||||
|
if (data_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Realloc error");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memset( data_Ptr + Buffer_Ptr->Data_Buf_Size, '\0', Taille_Alloc - Buffer_Ptr->Data_Buf_Size );
|
||||||
|
Buffer_Ptr->Data_Buf_Ptr = data_Ptr;
|
||||||
|
Buffer_Ptr->Data_Buf_Size = Taille_Alloc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data_Ptr = (IMRT_Buffer_Data *) malloc ( Taille_Alloc );
|
||||||
|
if (data_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Malloc error");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memset( data_Ptr, '\0', Taille_Alloc );
|
||||||
|
Buffer_Ptr->Data_Buf_Ptr = data_Ptr;
|
||||||
|
Buffer_Ptr->Status = IMRD_BUFFER_STATUS_ALLOCATED;
|
||||||
|
Buffer_Ptr->Data_Buf_Size = Taille_Alloc;
|
||||||
|
Buffer_Ptr->Data_Buf_Len = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Data_Free( IMRT_Buffer *Buffer_Ptr)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char *func_name = "MM_Fixed_StrHdl_Data_Free";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Buffer_Ptr->Status == IMRD_BUFFER_STATUS_ALLOCATED)
|
||||||
|
{
|
||||||
|
free(Buffer_Ptr->Data_Buf_Ptr);
|
||||||
|
Buffer_Ptr->Data_Buf_Ptr = NULL;
|
||||||
|
Buffer_Ptr->Status = IMRD_BUFFER_STATUS_FREED;
|
||||||
|
Buffer_Ptr->Data_Buf_Size = 0;
|
||||||
|
Buffer_Ptr->Data_Buf_Len = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status Fixed_Hdl_Format_Ident( IMRT_Buffer *Buffer_Ptr )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char *func_name = "Fixed_Hdl_Format_Ident";
|
||||||
|
|
||||||
|
|
||||||
|
if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Buffer_Ptr->Status == IMRD_BUFFER_STATUS_ALLOCATED)
|
||||||
|
{
|
||||||
|
status = IMRS_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer not allocated");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Ident( IMRT_Msg_Id *Msg_Id_Ident_Ptr,
|
||||||
|
IMRT_Buffer *Buffer_Ptr )
|
||||||
|
{
|
||||||
|
|
||||||
|
IMRT_Fmt_Id Format;
|
||||||
|
IMRT_Status status;
|
||||||
|
IMRT_Msg_Id *Msg_Id_Tmp;
|
||||||
|
char *func_name = "MM_Fixed_StrHdl_Ident";
|
||||||
|
|
||||||
|
|
||||||
|
if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Msg_Id_Ident_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Msg_Id_Ident_Ptr NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Format = Buffer_Ptr->Fmt_Id;
|
||||||
|
Msg_Id_Tmp = Msg_Id_Ident_Ptr;
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
IMRG_Fixed_Buffer_Ident_Ptr = Buffer_Ptr;
|
||||||
|
/* Le Msg_Id transmis au SDM est le point de depart de l'identification */
|
||||||
|
/* C'est egalement le resultat qui sera inclus dans le buffer */
|
||||||
|
status = IMR_SDM_MsgIdent_Proceed(Format,
|
||||||
|
Msg_Id_Tmp,
|
||||||
|
IMR_MM_Fixed_StrHdl_Field_Value,
|
||||||
|
IMR_MM_Fixed_StrHdl_Field_Exist,
|
||||||
|
IMR_MM_Fixed_StrHdl_Msg_Size);
|
||||||
|
IMRG_Fixed_Buffer_Ident_Ptr = NULL;
|
||||||
|
|
||||||
|
Msg_Id_Ident_Ptr = Msg_Id_Tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Open( IMRT_Buffer *Buffer_Ptr)
|
||||||
|
{
|
||||||
|
IMRT_Msg_Id type_temp;
|
||||||
|
IMRT_Status status;
|
||||||
|
char *func_name = "MM_Fixed_StrHdl_Open";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
type_temp = Buffer_Ptr->Msg_Id;
|
||||||
|
/* absence de données */
|
||||||
|
if (Buffer_Ptr->Status != IMRD_BUFFER_STATUS_ALLOCATED)
|
||||||
|
{
|
||||||
|
/* Cas d'open du buffer en ecriture */
|
||||||
|
/* le type du message est passe */
|
||||||
|
/* par le SDM : il doit donc etre connu */
|
||||||
|
if (type_temp == IMRD_MSG_ID_UNKNOWN)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Msg Id unknown");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = Fixed_Hdl_DataBuf_Alloc( Buffer_Ptr, FIXED_TAILLE_ALLOC );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* controle du format */
|
||||||
|
status = Fixed_Hdl_Format_Ident( Buffer_Ptr ) ;
|
||||||
|
if (status != IMRS_OK)
|
||||||
|
{
|
||||||
|
status = IMRS_BAD_FORMAT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Close( IMRT_Buffer *Buffer_Ptr)
|
||||||
|
{
|
||||||
|
char *func_name = "MM_Fixed_StrHdl_Close";
|
||||||
|
|
||||||
|
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Flush( IMRT_Buffer *Buffer_Ptr)
|
||||||
|
{
|
||||||
|
char *func_name = "MM_Fixed_StrHdl_Flush";
|
||||||
|
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Data_List( IMRT_Buffer *Buffer_Ptr)
|
||||||
|
{
|
||||||
|
if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_WARNING_0("Buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_3( IMRD_LOG_LEVEL_VERBOSE_1, "Buffer_List: Data_Buf_Ptr_Size: (%d) Data_Buf_Ptr_Len: (%d) Data_Buf_Ptr: (0x%X)", Buffer_Ptr->Data_Buf_Size, Buffer_Ptr->Data_Buf_Len, Buffer_Ptr->Data_Buf_Ptr);
|
||||||
|
IMRD_LM_LOG_TRACE_1( IMRD_LOG_LEVEL_VERBOSE_2, "Buffer_List: Data_Buf: [%s]", Buffer_Ptr->Data_Buf_Ptr);
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_2( IMRD_LOG_LEVEL_VERBOSE_1, "Buffer_List: Data_Tmp_Changed: (%d) Data_Tmp_Ptr: (0x%X)", Buffer_Ptr->Data_Tmp_Changed, Buffer_Ptr->Data_Tmp_Ptr);
|
||||||
|
if (Buffer_Ptr->Data_Tmp_Ptr != NULL)
|
||||||
|
IMRD_LM_LOG_TRACE_1( IMRD_LOG_LEVEL_VERBOSE_2, "Buffer_List: Data_Tmp: [%s]", Buffer_Ptr->Data_Tmp_Ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Copy( IMRT_Buffer *Output_Buffer_Ptr, IMRT_Buffer *Input_Buffer_Ptr )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char *func_name = "MM_Fixed_StrHdl_Copy";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (Input_Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Input buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Output_Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Output buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* controle donnees dans Input_Buffer */
|
||||||
|
if (Input_Buffer_Ptr->Status != IMRD_BUFFER_STATUS_ALLOCATED)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer input not allocated");
|
||||||
|
}
|
||||||
|
/* le buffer destinataire ne doit pas comporter de données */
|
||||||
|
else if ( ( Output_Buffer_Ptr->Status == IMRD_BUFFER_STATUS_ALLOCATED) ||
|
||||||
|
( Output_Buffer_Ptr->Data_Tmp_Ptr != NULL) )
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer output not allocated or Data_Tmp_Ptr no NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = Fixed_Hdl_DataBuf_Alloc(Output_Buffer_Ptr, Input_Buffer_Ptr->Data_Buf_Size);
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
memcpy( Output_Buffer_Ptr->Data_Buf_Ptr,
|
||||||
|
Input_Buffer_Ptr->Data_Buf_Ptr,
|
||||||
|
Input_Buffer_Ptr->Data_Buf_Size);
|
||||||
|
Output_Buffer_Ptr->Data_Buf_Len = Input_Buffer_Ptr->Data_Buf_Len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status Fixed_Hdl_Field_Exist(IMRT_Field *Field_Ptr , IMRT_Buffer *Buffer_Ptr)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char *func_name = "Fixed_Hdl_Field_Exist";
|
||||||
|
|
||||||
|
/* En fixed, pas de cas de champ inexistant */
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Get(IMRT_Buffer_Data **Data_Ptr_Ptr, IMRT_Field *Field_Ptr,
|
||||||
|
IMRT_Buffer *Buffer_Ptr , size_t *len )
|
||||||
|
{
|
||||||
|
IMRT_Buffer_Data *data_ptr;
|
||||||
|
IMRT_Status status;
|
||||||
|
int offsetTmp;
|
||||||
|
size_t sizeTmp;
|
||||||
|
char *func_name = "MM_Fixed_StrHdl_Get";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
data_ptr = NULL;
|
||||||
|
offsetTmp = 0;
|
||||||
|
sizeTmp = 0L;
|
||||||
|
|
||||||
|
if (Data_Ptr_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Data_Ptr_Ptr NULL");
|
||||||
|
}
|
||||||
|
else if (len == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("len pointer NULL");
|
||||||
|
}
|
||||||
|
else if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer_Ptr NULL");
|
||||||
|
}
|
||||||
|
else if (Field_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field_Ptr NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* Controle de validite de la taille */
|
||||||
|
if (Field_Ptr->Fixed.Size == IMRD_FIXED_SIZE_UNKNOWN)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Size Fixed unknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
/* controle sur l'offset */
|
||||||
|
if (Field_Ptr->Fixed.Offset > Buffer_Ptr->Data_Buf_Len )
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field offset out of data len");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Controle de l'existence du champ */
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
status = Fixed_Hdl_Field_Exist(Field_Ptr , Buffer_Ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Le champ n'existe pas => on prend la valeur par defaut */
|
||||||
|
/* Actuellement, ca ne peut pas arriver en Fixed */
|
||||||
|
if (status == IMRS_NO_IDENT)
|
||||||
|
{
|
||||||
|
sizeTmp = strlen(Field_Ptr->Fixed.Def_Val);
|
||||||
|
data_ptr = (IMRT_Buffer_Data *) malloc ( sizeTmp + 1);
|
||||||
|
if (data_ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Malloc error");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memset( data_ptr, '\0', sizeTmp + 1 );
|
||||||
|
memcpy(data_ptr , Field_Ptr->Fixed.Def_Val , sizeTmp );
|
||||||
|
*(data_ptr + sizeTmp) = '\0';
|
||||||
|
*Data_Ptr_Ptr = data_ptr;
|
||||||
|
status = IMRS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
/* cas ou Field_Ptr->Fixed.Size = 0 => on prend tout le champ */
|
||||||
|
/* idem si offset + size > len du message */
|
||||||
|
if((Field_Ptr->Fixed.Size == 0L) ||( Field_Ptr->Fixed.Offset + Field_Ptr->Fixed.Size > Buffer_Ptr->Data_Buf_Len ) )
|
||||||
|
{
|
||||||
|
sizeTmp = Buffer_Ptr->Data_Buf_Len - Field_Ptr->Fixed.Offset;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sizeTmp = Field_Ptr->Fixed.Size;
|
||||||
|
}
|
||||||
|
data_ptr = (IMRT_Buffer_Data *) malloc ( sizeTmp + 1);
|
||||||
|
if (data_ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Malloc error");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memcpy( data_ptr,
|
||||||
|
Buffer_Ptr->Data_Buf_Ptr + Field_Ptr->Fixed.Offset,
|
||||||
|
sizeTmp);
|
||||||
|
*(data_ptr + sizeTmp) = '\0';
|
||||||
|
*Data_Ptr_Ptr = data_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
*len = sizeTmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status IMR_MM_Fixed_StrHdl_Msg_Size ( size_t Msg_Size)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char *func_name = "IMR_MM_Fixed_StrHdl_Msg_Size";
|
||||||
|
|
||||||
|
if (IMRG_Fixed_Buffer_Ident_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer pointer NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "============================================================================")
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "Size msg demand : Begin");
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Msg_Size : (%ld)" , Msg_Size);
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Length of the buffer data : (%ld)" , IMRG_Fixed_Buffer_Ident_Ptr->Data_Buf_Len);
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (Msg_Size != IMRG_Fixed_Buffer_Ident_Ptr->Data_Buf_Len)
|
||||||
|
status = IMRS_NO_IDENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_2 , "Size msg demand : End with status : (%d)" , status);
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_2 , "============================================================================")
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status IMR_MM_Fixed_StrHdl_Field_Exist( IMRT_Field *Field_Ptr )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char *func_name = "IMR_MM_Fixed_StrHdl_Field_Exist";
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (Field_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field_Ptr NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "============================================================================")
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "Existing field demand : Begin");
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Field Input name : [%s]" , Field_Ptr->Name);
|
||||||
|
|
||||||
|
if (IMRG_Fixed_Buffer_Ident_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer pointer NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = Fixed_Hdl_Field_Exist( Field_Ptr, IMRG_Fixed_Buffer_Ident_Ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_2 , "Existing field demand : End with status : (%d)" , status);
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_2 , "============================================================================")
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status IMR_MM_Fixed_StrHdl_Field_Value( IMRT_Field *Field_Ptr , IMRT_Field_Value_Id Value_Id )
|
||||||
|
{
|
||||||
|
IMRT_Buffer_Data *data_ptr;
|
||||||
|
IMRT_Status status;
|
||||||
|
size_t field_len;
|
||||||
|
char *func_name = "IMR_MM_Fixed_StrHdl_Field_Value";
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (Field_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field_Ptr NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "============================================================================")
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "Field Value demand : Begin");
|
||||||
|
IMRD_LM_LOG_TRACE_2(IMRD_LOG_LEVEL_VERBOSE_1 , "Field Input name : [%s] Value Id : [%s]" , Field_Ptr->Name , Value_Id);
|
||||||
|
|
||||||
|
field_len = 0L;
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (IMRG_Fixed_Buffer_Ident_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer pointer NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = MM_Fixed_StrHdl_Get(&data_ptr, Field_Ptr, IMRG_Fixed_Buffer_Ident_Ptr , &field_len );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_2 , "Value extracted : [%s]" , data_ptr);
|
||||||
|
if (strcmp(data_ptr, Value_Id) != 0)
|
||||||
|
{
|
||||||
|
status = IMRS_NO_IDENT;
|
||||||
|
}
|
||||||
|
free(data_ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_2 , "Field Value demand : End with status : (%d)" , status);
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_2 , "============================================================================")
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Convert(IMRT_Buffer_Data **Data_Output_Ptr , IMRT_Buffer_Data *Data_Input_Ptr , IMRT_Field *Field_Ptr,
|
||||||
|
size_t *len , IMRT_StrHdl_Cnv_Func *Cnv_Func_Tab )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
size_t size;
|
||||||
|
char *func_name = "MM_Fixed_StrHdl_Convert";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (Cnv_Func_Tab == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Cnv_Func_Tab NULL");
|
||||||
|
}
|
||||||
|
else if (Data_Output_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Data_Output_Ptr NULL");
|
||||||
|
}
|
||||||
|
else if (len == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("len pointer NULL");
|
||||||
|
}
|
||||||
|
else if (Field_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field_Ptr NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Data_Input_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Data_Input_Ptr NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size = Field_Ptr->Fixed.Size ;
|
||||||
|
|
||||||
|
*Data_Output_Ptr = (IMRT_Buffer_Data *)malloc(size + 1L);
|
||||||
|
if (*Data_Output_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("*Data_Output_Ptr NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memset(*Data_Output_Ptr, '\0' , (size + 1L) );
|
||||||
|
|
||||||
|
/* Appel de la fonction de convertion */
|
||||||
|
if ((Field_Ptr->Fixed.Cnv_Ptr == NULL) || (Cnv_Func_Tab[Field_Ptr->Fixed.Cnv_Ptr->Id].Convert_Ptr == NULL))
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_1 , "Pas de fonction de conversion");
|
||||||
|
|
||||||
|
if (Data_Input_Ptr != NULL)
|
||||||
|
memcpy(*Data_Output_Ptr,Data_Input_Ptr,*len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = Cnv_Func_Tab[Field_Ptr->Fixed.Cnv_Ptr->Id].Convert_Ptr(*Data_Output_Ptr,
|
||||||
|
Data_Input_Ptr,
|
||||||
|
len ,
|
||||||
|
size ,
|
||||||
|
Field_Ptr->Fixed.Cnv_Attr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Data_Input_Ptr != NULL)
|
||||||
|
free(Data_Input_Ptr);
|
||||||
|
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Put(IMRT_Buffer_Data *Data_Ptr, IMRT_Field *Field_Ptr,
|
||||||
|
IMRT_Buffer *Buffer_Ptr , size_t len )
|
||||||
|
{
|
||||||
|
IMRT_Buffer_Data *data_buf_ptr;
|
||||||
|
size_t data_len;
|
||||||
|
size_t data_max_len;
|
||||||
|
IMRT_Status status;
|
||||||
|
char *func_name = "MM_Fixed_StrHdl_Put";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer_Ptr NULL");
|
||||||
|
}
|
||||||
|
else if (Field_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field_Ptr NULL");
|
||||||
|
}
|
||||||
|
else if (Data_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("data pointer NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* Controle de validite de la taille */
|
||||||
|
if (Field_Ptr->Fixed.Size == IMRD_FIXED_SIZE_UNKNOWN)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Size Fixed unknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
if (strcmp(Data_Ptr , "") == 0)
|
||||||
|
status = IMRD_STATUS_NOTHING_TO_DO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ( status == IMRS_OK )
|
||||||
|
{
|
||||||
|
data_len = len ;
|
||||||
|
data_max_len = Field_Ptr->Fixed.Offset + data_len ;
|
||||||
|
|
||||||
|
/* controle sur la valeur */
|
||||||
|
if ( data_len > Field_Ptr->Fixed.Size )
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_2("Data len (%ld) superior to data size (%ld)",data_len , Field_Ptr->Fixed.Size);
|
||||||
|
}
|
||||||
|
else if ( Buffer_Ptr->Data_Buf_Size <= data_max_len )
|
||||||
|
{
|
||||||
|
status = Fixed_Hdl_DataBuf_Alloc( Buffer_Ptr, data_max_len + 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( status == IMRS_OK )
|
||||||
|
{
|
||||||
|
/* insertion de la valeur dans les donnees du buffer */
|
||||||
|
data_buf_ptr = Buffer_Ptr->Data_Buf_Ptr + Field_Ptr->Fixed.Offset;
|
||||||
|
memcpy(data_buf_ptr, Data_Ptr, data_len);
|
||||||
|
|
||||||
|
if ( Buffer_Ptr->Data_Buf_Len < data_max_len )
|
||||||
|
{
|
||||||
|
Buffer_Ptr->Data_Buf_Len = data_max_len;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == IMRD_STATUS_NOTHING_TO_DO)
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (Data_Ptr != NULL)
|
||||||
|
free(Data_Ptr);
|
||||||
|
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
104
src/libmapping_mng/src/fmt_hdl_fixed.h
Normal file
104
src/libmapping_mng/src/fmt_hdl_fixed.h
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: fmt_hdl_fixed.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _FIXED_HANDLER_H_
|
||||||
|
#define _FIXED_HANDLER_H_
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "libmapping_mng.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _FIXED_HANDLER_C_
|
||||||
|
|
||||||
|
# define FIXED_TAILLE_ALLOC 100000
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
#ifdef _FIXED_HANDLER_C_
|
||||||
|
|
||||||
|
IMRT_Buffer *IMRG_Fixed_Buffer_Ident_Ptr;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _FIXED_HANDLER_C_
|
||||||
|
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Init ( void );
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_DeInit ( void );
|
||||||
|
IMRT_Status Fixed_Hdl_DataBuf_Alloc ( IMRT_Buffer * , size_t );
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Data_Free ( IMRT_Buffer * );
|
||||||
|
IMRT_Status Fixed_Hdl_Format_Ident ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Ident ( IMRT_Msg_Id * , IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Open ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Close ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Flush ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Data_List ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Copy ( IMRT_Buffer * , IMRT_Buffer * );
|
||||||
|
IMRT_Status Fixed_Hdl_Field_Exist ( IMRT_Field * , IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Get ( IMRT_Buffer_Data ** , IMRT_Field * , IMRT_Buffer * , size_t * );
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Convert ( IMRT_Buffer_Data ** , IMRT_Buffer_Data * , IMRT_Field * , size_t *, IMRT_StrHdl_Cnv_Func * );
|
||||||
|
IMRT_Status MM_Fixed_StrHdl_Put ( IMRT_Buffer_Data * , IMRT_Field * , IMRT_Buffer * , size_t );
|
||||||
|
IMRT_Status IMR_MM_Fixed_StrHdl_Field_Value ( IMRT_Field * , IMRT_Field_Value_Id);
|
||||||
|
IMRT_Status IMR_MM_Fixed_StrHdl_Field_Exist ( IMRT_Field * );
|
||||||
|
IMRT_Status IMR_MM_Fixed_StrHdl_Msg_Size ( size_t );
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
extern IMRT_Status MM_Fixed_StrHdl_Init ( void );
|
||||||
|
extern IMRT_Status MM_Fixed_StrHdl_DeInit ( void );
|
||||||
|
extern IMRT_Status MM_Fixed_StrHdl_Library_Open ( void );
|
||||||
|
extern IMRT_Status MM_Fixed_StrHdl_Data_Free ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Fixed_StrHdl_Ident ( IMRT_Msg_Id * , IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Fixed_StrHdl_Open ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Fixed_StrHdl_Close ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Fixed_StrHdl_Flush ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Fixed_StrHdl_Data_List ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Fixed_StrHdl_Copy ( IMRT_Buffer * , IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_Fixed_StrHdl_Get ( IMRT_Buffer_Data ** , IMRT_Field * , IMRT_Buffer * , size_t * );
|
||||||
|
extern IMRT_Status MM_Fixed_StrHdl_Convert ( IMRT_Buffer_Data ** , IMRT_Buffer_Data * , IMRT_Field * , size_t *, IMRT_StrHdl_Cnv_Func * );
|
||||||
|
extern IMRT_Status MM_Fixed_StrHdl_Put ( IMRT_Buffer_Data * , IMRT_Field * , IMRT_Buffer * , size_t );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
835
src/libmapping_mng/src/fmt_hdl_fml.c
Normal file
835
src/libmapping_mng/src/fmt_hdl_fml.c
Normal file
@ -0,0 +1,835 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: fmt_hdl_fml.c */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBMAPPING_MNG_
|
||||||
|
#define _FML_HANDLER_C_
|
||||||
|
|
||||||
|
#include "fmt_hdl_fml.h"
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status MM_FML_StrHdl_Init()
|
||||||
|
{
|
||||||
|
IMRG_FML_Buffer_Ident_Ptr = NULL;
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_FML_StrHdl_DeInit()
|
||||||
|
{
|
||||||
|
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status FML_Hdl_DataBuf_Alloc( IMRT_Buffer *Buffer_Ptr )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
int retour;
|
||||||
|
char *func_name = "FML_Hdl_DataBuf_Alloc";
|
||||||
|
FBFR32 *tpFBbuf;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
tpFBbuf = NULL;
|
||||||
|
status = IMRS_OK;
|
||||||
|
retour = 0;
|
||||||
|
|
||||||
|
|
||||||
|
if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Buffer_Ptr->Status != IMRD_BUFFER_STATUS_ALLOCATED)
|
||||||
|
{
|
||||||
|
tpFBbuf = (FBFR32 *)tpalloc((char *) IMRD_FML_TYPE , NULL, Fneeded32(IMRD_FML_MAX_FLD, IMRD_FML_SIZE) );
|
||||||
|
|
||||||
|
if (tpFBbuf == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Error tpalloc");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
|
||||||
|
retour = Finit32(tpFBbuf, (FLDLEN32) Fsizeof32(tpFBbuf));
|
||||||
|
|
||||||
|
if (retour == -1)
|
||||||
|
{
|
||||||
|
if (Ferror32 == FNOSPACE)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Ferror32 = FNOSPACE");
|
||||||
|
}
|
||||||
|
else if (Ferror32 == FALIGNERR)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Ferror32 = FALIGNERR");
|
||||||
|
}
|
||||||
|
else if (Ferror32 == FNOTFLD)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Ferror32 = FNOTFLD");
|
||||||
|
}
|
||||||
|
else if (Ferror32 == FEINVAL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Ferror32 = FEINVAL");
|
||||||
|
}
|
||||||
|
else if (Ferror32 == FBADFLD)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Ferror32 = FBADFLD");
|
||||||
|
}
|
||||||
|
status = IMRS_KO;
|
||||||
|
tpfree((char *)tpFBbuf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
Buffer_Ptr->Data_Buf_Ptr = (IMRT_Buffer_Data *)tpFBbuf;
|
||||||
|
Buffer_Ptr->Status = IMRD_BUFFER_STATUS_ALLOCATED;
|
||||||
|
Buffer_Ptr->Data_Buf_Size = IMRD_FML_SIZE;
|
||||||
|
Buffer_Ptr->Data_Buf_Len = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return status;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status MM_FML_StrHdl_Data_Free( IMRT_Buffer *Buffer_Ptr)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char *func_name = "MM_FML_StrHdl_Data_Free";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Buffer_Ptr->Status == IMRD_BUFFER_STATUS_ALLOCATED)
|
||||||
|
{
|
||||||
|
tpfree((char *)Buffer_Ptr->Data_Buf_Ptr);
|
||||||
|
Buffer_Ptr->Data_Buf_Ptr = NULL;
|
||||||
|
Buffer_Ptr->Status = IMRD_BUFFER_STATUS_FREED;
|
||||||
|
Buffer_Ptr->Data_Buf_Size = 0;
|
||||||
|
Buffer_Ptr->Data_Buf_Len = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status FML_Hdl_Format_Ident( IMRT_Buffer *Buffer_Ptr )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char *func_name = "FML_Hdl_Format_Ident";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_KO;
|
||||||
|
|
||||||
|
if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Buffer_Ptr->Status == IMRD_BUFFER_STATUS_ALLOCATED)
|
||||||
|
{
|
||||||
|
/* Controle du format FML */
|
||||||
|
if (Fnum32((FBFR32 *)Buffer_Ptr->Data_Buf_Ptr) != -1)
|
||||||
|
{
|
||||||
|
status = IMRS_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer not allocated");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_FML_StrHdl_Ident( IMRT_Msg_Id *Msg_Id_Ident_Ptr,
|
||||||
|
IMRT_Buffer *Buffer_Ptr )
|
||||||
|
{
|
||||||
|
|
||||||
|
IMRT_Fmt_Id Format;
|
||||||
|
IMRT_Status status;
|
||||||
|
IMRT_Msg_Id *Msg_Id_Tmp;
|
||||||
|
char *func_name = "MM_FML_StrHdl_Ident";
|
||||||
|
|
||||||
|
|
||||||
|
if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Msg_Id_Ident_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Msg_Id_Ident_Ptr NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Format = Buffer_Ptr->Fmt_Id;
|
||||||
|
Msg_Id_Tmp = Msg_Id_Ident_Ptr;
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
IMRG_FML_Buffer_Ident_Ptr = Buffer_Ptr;
|
||||||
|
/* Le Msg_Id transmis au SDM est le point de depart de l'identification */
|
||||||
|
/* C'est egalement le resultat qui sera inclus dans le buffer */
|
||||||
|
status = IMR_SDM_MsgIdent_Proceed(Format,
|
||||||
|
Msg_Id_Tmp,
|
||||||
|
IMR_MM_FML_StrHdl_Field_Value,
|
||||||
|
IMR_MM_FML_StrHdl_Field_Exist,
|
||||||
|
IMR_MM_FML_StrHdl_Msg_Size);
|
||||||
|
IMRG_FML_Buffer_Ident_Ptr = NULL;
|
||||||
|
|
||||||
|
Msg_Id_Ident_Ptr = Msg_Id_Tmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_FML_StrHdl_Open( IMRT_Buffer *Buffer_Ptr)
|
||||||
|
{
|
||||||
|
IMRT_Msg_Id type_temp;
|
||||||
|
IMRT_Status status;
|
||||||
|
char *func_name = "MM_FML_StrHdl_Open";
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
type_temp = Buffer_Ptr->Msg_Id;
|
||||||
|
|
||||||
|
/* absence de données */
|
||||||
|
if (Buffer_Ptr->Status != IMRD_BUFFER_STATUS_ALLOCATED)
|
||||||
|
{
|
||||||
|
/* Cas d'open du buffer en ecriture */
|
||||||
|
/* le type du message est passe */
|
||||||
|
/* par le SDM : il doit donc etre connu */
|
||||||
|
if (type_temp == IMRD_MSG_ID_UNKNOWN)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Msg Id unknown");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = FML_Hdl_DataBuf_Alloc( Buffer_Ptr );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* controle du format */
|
||||||
|
status = FML_Hdl_Format_Ident( Buffer_Ptr );
|
||||||
|
/* format non reconnu */
|
||||||
|
if (status != IMRS_OK)
|
||||||
|
status = IMRS_BAD_FORMAT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_FML_StrHdl_Close( IMRT_Buffer *Buffer_Ptr)
|
||||||
|
{
|
||||||
|
char *func_name = "MM_FML_StrHdl_Close";
|
||||||
|
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_FML_StrHdl_Flush( IMRT_Buffer *Buffer_Ptr)
|
||||||
|
{
|
||||||
|
char *func_name = "MM_FML_StrHdl_Flush";
|
||||||
|
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_FML_StrHdl_Data_List( IMRT_Buffer *Buffer_Ptr)
|
||||||
|
{
|
||||||
|
if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_WARNING_0("Buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_3( IMRD_LOG_LEVEL_VERBOSE_1, "Buffer_List: Data_Buf_Ptr_Size: (%d) Data_Buf_Ptr_Len: (%d) Data_Buf_Ptr: (0x%X)", Buffer_Ptr->Data_Buf_Size, Buffer_Ptr->Data_Buf_Len, Buffer_Ptr->Data_Buf_Ptr);
|
||||||
|
|
||||||
|
IMRD_LM_EXEC_TRACE( IMRD_LOG_LEVEL_VERBOSE_2, "Buffer_List: Data_Tmp: [", Ffprint32( (FBFR32 *)Buffer_Ptr->Data_Buf_Ptr, IMRD_LM_STREAM_OUT), "]");
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_2( IMRD_LOG_LEVEL_VERBOSE_1, "Buffer_List: Data_Tmp_Changed: (%d) Data_Tmp_Ptr: (0x%X)", Buffer_Ptr->Data_Tmp_Changed, Buffer_Ptr->Data_Tmp_Ptr);
|
||||||
|
|
||||||
|
if (Buffer_Ptr->Data_Tmp_Ptr != NULL)
|
||||||
|
IMRD_LM_LOG_TRACE_1( IMRD_LOG_LEVEL_VERBOSE_2, "Buffer_List: Data_Tmp: [%s]", Buffer_Ptr->Data_Tmp_Ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_FML_StrHdl_Copy( IMRT_Buffer *Output_Buffer_Ptr, IMRT_Buffer *Input_Buffer_Ptr )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char *func_name = "MM_FML_StrHdl_Copy";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (Input_Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Input buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Output_Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Output buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* controle donnees dans Input_Buffer */
|
||||||
|
if (Input_Buffer_Ptr->Status != IMRD_BUFFER_STATUS_ALLOCATED)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0( "Buffer input not allocated");
|
||||||
|
}
|
||||||
|
/* le buffer destinataire ne doit pas comporter de donnees */
|
||||||
|
else if ( ( Output_Buffer_Ptr->Status == IMRD_BUFFER_STATUS_ALLOCATED) ||
|
||||||
|
( Output_Buffer_Ptr->Data_Tmp_Ptr != NULL) )
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer output not allocated or Data_Tmp_Ptr no NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = FML_Hdl_DataBuf_Alloc(Output_Buffer_Ptr);
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
/* copie de buffer FML */
|
||||||
|
Fcpy32((FBFR32 *)Output_Buffer_Ptr->Data_Buf_Ptr , (FBFR32 *)Input_Buffer_Ptr->Data_Buf_Ptr);
|
||||||
|
Output_Buffer_Ptr->Data_Buf_Len = Fused32((FBFR32 *)Output_Buffer_Ptr->Data_Buf_Ptr);
|
||||||
|
|
||||||
|
/* doit on faire la maj du size et du len pour le FML ??? */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status FML_Hdl_Field_Exist(IMRT_Field *Field_Ptr , IMRT_Buffer *Buffer_Ptr , FLDID32 FML_Field)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
FLDOCC32 retour;
|
||||||
|
char *func_name = "FML_Hdl_Field_Exist";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
retour = 0;
|
||||||
|
|
||||||
|
if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Field_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field pointer NULL" );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
retour = Foccur32((FBFR32 *)Buffer_Ptr->Data_Buf_Ptr, FML_Field);
|
||||||
|
|
||||||
|
if (retour == 0 )
|
||||||
|
{
|
||||||
|
status = IMRS_NO_IDENT;
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "Field not exist");
|
||||||
|
}
|
||||||
|
else if (retour == -1 )
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_1("Foccur32 error [%s]" , Fstrerror32(Ferror32));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* dans la fonction get, il conviendra d'etudier la necessite ou non de developper :
|
||||||
|
- la conversion des types
|
||||||
|
- la possibilite de champ multi-occurrence
|
||||||
|
*/
|
||||||
|
IMRT_Status MM_FML_StrHdl_Get(IMRT_Buffer_Data **Data_Ptr_Ptr, IMRT_Field *Field_Ptr,
|
||||||
|
IMRT_Buffer *Buffer_Ptr , size_t *len )
|
||||||
|
{
|
||||||
|
IMRT_Buffer_Data *data_ptr;
|
||||||
|
IMRT_Status status;
|
||||||
|
int retour;
|
||||||
|
FLDID32 FML_Field;
|
||||||
|
size_t sizeTmp;
|
||||||
|
char *func_name = "MM_FML_StrHdl_Get";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
retour = 0;
|
||||||
|
data_ptr = NULL;
|
||||||
|
sizeTmp = 0L;
|
||||||
|
|
||||||
|
if (Data_Ptr_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Data_Ptr_Ptr NULL");
|
||||||
|
}
|
||||||
|
else if (len == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("len pointer NULL");
|
||||||
|
}
|
||||||
|
else if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer_Ptr NULL");
|
||||||
|
}
|
||||||
|
else if (Field_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field_Ptr NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* Controle de validite du tag */
|
||||||
|
if (strcmp(Field_Ptr->FML.Tag ,IMRD_FML_TAG_UNKNOWN) == 0)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Tag FML unknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
FML_Field = Fldid32( Field_Ptr->FML.Tag );
|
||||||
|
|
||||||
|
if ( FML_Field == BADFLDID )
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_1("Fldid32 %s BADFLDID error",Field_Ptr->FML.Tag );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
status = FML_Hdl_Field_Exist(Field_Ptr , Buffer_Ptr , FML_Field);
|
||||||
|
}
|
||||||
|
/* Le champ n'existe pas => on prend la valeur par defaut */
|
||||||
|
if (status == IMRS_NO_IDENT)
|
||||||
|
{
|
||||||
|
sizeTmp = strlen(Field_Ptr->FML.Def_Val);
|
||||||
|
data_ptr = (IMRT_Buffer_Data *) malloc ( sizeTmp + 1);
|
||||||
|
if (data_ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Malloc error");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memset( data_ptr, '\0', sizeTmp + 1 );
|
||||||
|
memcpy(data_ptr , Field_Ptr->FML.Def_Val , sizeTmp );
|
||||||
|
*(data_ptr + sizeTmp) = '\0';
|
||||||
|
*Data_Ptr_Ptr = data_ptr;
|
||||||
|
status = IMRS_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* le champ existe => on extrait la valeur */
|
||||||
|
else if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
/*data_ptr = (IMRT_Buffer_Data *) malloc ( (Field_Ptr->Fixed.Size + 1));
|
||||||
|
memset( data_ptr, '\0', Field_Ptr->Fixed.Size + 1 );*/
|
||||||
|
data_ptr = (IMRT_Buffer_Data *) malloc ( IMRD_FML_SIZE);
|
||||||
|
memset( data_ptr, '\0', IMRD_FML_SIZE );
|
||||||
|
retour = (IMRT_Status)Fget32((FBFR32 *)Buffer_Ptr->Data_Buf_Ptr,
|
||||||
|
FML_Field,
|
||||||
|
(FLDOCC32 )0L,
|
||||||
|
(char *)data_ptr,
|
||||||
|
0);
|
||||||
|
|
||||||
|
|
||||||
|
if (retour == -1)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_3("Fget32 failed with error [%s] Field (%d) [%s]" , Fstrerror32(Ferror32) , FML_Field, Fname32(FML_Field));
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*Data_Ptr_Ptr = data_ptr;
|
||||||
|
sizeTmp = (size_t) strlen(data_ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
*len = sizeTmp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status IMR_MM_FML_StrHdl_Msg_Size ( size_t Msg_Size)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char *func_name = "IMR_MM_FML_StrHdl_Msg_Size";
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "============================================================================")
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "Size msg demand : Begin");
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Msg_Size : (%ld)" , Msg_Size);
|
||||||
|
|
||||||
|
/* Erreur de referentiel */
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_WARNING_0("Referential error ; this should never happen");
|
||||||
|
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_2 , "Size msg demand : End with status : (%d)" , status);
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_2 , "============================================================================")
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status IMR_MM_FML_StrHdl_Field_Exist( IMRT_Field *Field_Ptr )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
FLDID32 FML_Field;
|
||||||
|
char *func_name = "IMR_MM_FML_StrHdl_Field_Exist";
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (Field_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field_Ptr NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "============================================================================")
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "Existing field demand : Begin");
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Field Input name : [%s]" , Field_Ptr->Name);
|
||||||
|
|
||||||
|
if (IMRG_FML_Buffer_Ident_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer pointer NULL");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
FML_Field = Fldid32( Field_Ptr->FML.Tag );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( FML_Field == BADFLDID )
|
||||||
|
{
|
||||||
|
status = IMRS_NO_IDENT;
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Field [%s] BADFLDID error",Field_Ptr->FML.Tag );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
status = FML_Hdl_Field_Exist(Field_Ptr , IMRG_FML_Buffer_Ident_Ptr , FML_Field);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_2 , "Existing field demand : End with status : (%d)" , status);
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_2 , "============================================================================")
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status IMR_MM_FML_StrHdl_Field_Value( IMRT_Field *Field_Ptr , IMRT_Field_Value_Id Value_Id )
|
||||||
|
{
|
||||||
|
IMRT_Buffer_Data *data_ptr;
|
||||||
|
IMRT_Status status;
|
||||||
|
size_t field_len;
|
||||||
|
char *func_name = "IMR_MM_FML_StrHdl_Field_Value";
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (Field_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field_Ptr NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "============================================================================")
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "Field Value demand : Begin");
|
||||||
|
IMRD_LM_LOG_TRACE_2(IMRD_LOG_LEVEL_VERBOSE_1 , "Field Input name : [%s] Value Id : [%s]" , Field_Ptr->Name , Value_Id);
|
||||||
|
|
||||||
|
field_len = 0L;
|
||||||
|
|
||||||
|
if (IMRG_FML_Buffer_Ident_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer pointer NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = MM_FML_StrHdl_Get(&data_ptr, Field_Ptr, IMRG_FML_Buffer_Ident_Ptr , &field_len );
|
||||||
|
}
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_2 , "Value extracted : [%s]" , data_ptr);
|
||||||
|
if (strcmp(data_ptr, Value_Id) != 0)
|
||||||
|
{
|
||||||
|
status = IMRS_NO_IDENT;
|
||||||
|
}
|
||||||
|
free(data_ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_2 , "Field Value demand : End with status : (%d)" , status);
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_2 , "============================================================================")
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_FML_StrHdl_Convert(IMRT_Buffer_Data **Data_Output_Ptr , IMRT_Buffer_Data *Data_Input_Ptr , IMRT_Field *Field_Ptr,
|
||||||
|
size_t *len , IMRT_StrHdl_Cnv_Func *Cnv_Func_Tab )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
size_t size;
|
||||||
|
char *func_name = "MM_FML_StrHdl_Convert";
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (len == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("len pointer NULL");
|
||||||
|
}
|
||||||
|
else if (Data_Output_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Data_Output_Ptr NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size = *len ;
|
||||||
|
*Data_Output_Ptr = (IMRT_Buffer_Data *)malloc(size + 1L);
|
||||||
|
if (*Data_Output_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("*Data_Output_Ptr NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
memset( *Data_Output_Ptr, '\0' , (size + 1L) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
if (Field_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field_Ptr NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Data_Input_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Data_Input_Ptr NULL");
|
||||||
|
}
|
||||||
|
else if (Cnv_Func_Tab == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Cnv_Func_Tab NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Appel de la fonction de convertion */
|
||||||
|
if ((Field_Ptr->FML.Cnv_Ptr == NULL) || (Cnv_Func_Tab[Field_Ptr->FML.Cnv_Ptr->Id].Convert_Ptr == NULL))
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_1 , "Pas de fonction de conversion");
|
||||||
|
|
||||||
|
if (Data_Input_Ptr != NULL)
|
||||||
|
memcpy(*Data_Output_Ptr,Data_Input_Ptr,*len);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = Cnv_Func_Tab[Field_Ptr->FML.Cnv_Ptr->Id].Convert_Ptr(*Data_Output_Ptr,
|
||||||
|
Data_Input_Ptr,
|
||||||
|
len,
|
||||||
|
size ,
|
||||||
|
Field_Ptr->FML.Cnv_Attr );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Data_Input_Ptr != NULL)
|
||||||
|
free(Data_Input_Ptr);
|
||||||
|
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_FML_StrHdl_Put(IMRT_Buffer_Data *Data_Ptr, IMRT_Field *Field_Ptr,
|
||||||
|
IMRT_Buffer *Buffer_Ptr , size_t len )
|
||||||
|
{
|
||||||
|
IMRT_Buffer_Data *data_buf_ptr;
|
||||||
|
FLDID32 FML_Field;
|
||||||
|
FLDLEN32 FML_maxlen;
|
||||||
|
IMRT_Status status;
|
||||||
|
int retour;
|
||||||
|
char *func_name = "MM_FML_StrHdl_Put";
|
||||||
|
size_t longueur;
|
||||||
|
int FML_Field_Type;
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
retour = 0;
|
||||||
|
|
||||||
|
if (Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer_Ptr NULL");
|
||||||
|
}
|
||||||
|
else if (Field_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Field_Ptr NULL");
|
||||||
|
}
|
||||||
|
else if (Data_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("data pointer NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
/* Controle de validite du tag */
|
||||||
|
if (strcmp(Field_Ptr->FML.Tag ,IMRD_FML_TAG_UNKNOWN) == 0)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Tag FML unknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((status == IMRS_OK) && (strcmp(Data_Ptr , "") == 0))
|
||||||
|
status = IMRD_STATUS_NOTHING_TO_DO;
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
FML_maxlen = (FLDLEN32)0L;
|
||||||
|
FML_Field = Fldid32( Field_Ptr->FML.Tag );
|
||||||
|
if ( FML_Field == BADFLDID )
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_1("Fldid32 %s BADFLDID error",Field_Ptr->FML.Tag );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FML_Field_Type = Fldtype32(FML_Field);
|
||||||
|
if (FML_Field_Type == FLD_CARRAY)
|
||||||
|
{
|
||||||
|
longueur = len;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
longueur = 0L;
|
||||||
|
}
|
||||||
|
|
||||||
|
retour = Fadd32((FBFR32 *)Buffer_Ptr->Data_Buf_Ptr,
|
||||||
|
FML_Field,
|
||||||
|
(char *)Data_Ptr,
|
||||||
|
(FLDLEN32) longueur);
|
||||||
|
|
||||||
|
if (retour == -1)
|
||||||
|
{
|
||||||
|
if (Ferror32 == FNOSPACE)
|
||||||
|
/* prevoir la realloc */
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Ferror32 = FNOSPACE");
|
||||||
|
}
|
||||||
|
else if (Ferror32 == FALIGNERR)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Ferror32 = FALIGNERR");
|
||||||
|
}
|
||||||
|
else if (Ferror32 == FNOTFLD)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Ferror32 = FNOTFLD");
|
||||||
|
}
|
||||||
|
else if (Ferror32 == FEINVAL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Ferror32 = FEINVAL");
|
||||||
|
}
|
||||||
|
else if (Ferror32 == FBADFLD)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Ferror32 = FBADFLD");
|
||||||
|
}
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
/* Mise a jour de la taille du buffer */
|
||||||
|
Buffer_Ptr->Data_Buf_Len = (Buffer_Ptr->Data_Buf_Len) + Fsizeof32((FBFR32 *)Buffer_Ptr->Data_Buf_Ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status == IMRD_STATUS_NOTHING_TO_DO)
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (Data_Ptr != NULL)
|
||||||
|
free(Data_Ptr);
|
||||||
|
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
108
src/libmapping_mng/src/fmt_hdl_fml.h
Normal file
108
src/libmapping_mng/src/fmt_hdl_fml.h
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: fmt_hdl_xml.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _FML_HANDLER_H_
|
||||||
|
#define _FML_HANDLER_H_
|
||||||
|
|
||||||
|
#include "fml.h"
|
||||||
|
#include "fml32.h"
|
||||||
|
#include "atmi.h"
|
||||||
|
#include "field.tbls.h"
|
||||||
|
#include "userlog.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "libmapping_mng.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _FML_HANDLER_C_
|
||||||
|
|
||||||
|
#define IMRD_FML_TYPE "FML32"
|
||||||
|
#define IMRD_FML_SIZE (FLDLEN32)10000L
|
||||||
|
#define IMRD_FML_MAX_FLD (FLDOCC32)50L
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _FML_HANDLER_C_
|
||||||
|
|
||||||
|
IMRT_Buffer *IMRG_FML_Buffer_Ident_Ptr;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _FML_HANDLER_C_
|
||||||
|
|
||||||
|
IMRT_Status MM_FML_StrHdl_Init ( void );
|
||||||
|
IMRT_Status MM_FML_StrHdl_DeInit ( void );
|
||||||
|
IMRT_Status FML_Hdl_DataBuf_Alloc ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_FML_StrHdl_Data_Free ( IMRT_Buffer * );
|
||||||
|
IMRT_Status FML_Hdl_Format_Ident ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_FML_StrHdl_Ident ( IMRT_Msg_Id * , IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_FML_StrHdl_Open ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_FML_StrHdl_Close ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_FML_StrHdl_Flush ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_FML_StrHdl_Data_List ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_FML_StrHdl_Copy ( IMRT_Buffer * , IMRT_Buffer * );
|
||||||
|
IMRT_Status FML_Hdl_Field_Exist ( IMRT_Field * , IMRT_Buffer * , FLDID32 );
|
||||||
|
IMRT_Status MM_FML_StrHdl_Get (IMRT_Buffer_Data ** , IMRT_Field * , IMRT_Buffer * , size_t * );
|
||||||
|
IMRT_Status MM_FML_StrHdl_Convert (IMRT_Buffer_Data ** , IMRT_Buffer_Data * , IMRT_Field * , size_t *, IMRT_StrHdl_Cnv_Func * );
|
||||||
|
IMRT_Status MM_FML_StrHdl_Put (IMRT_Buffer_Data * , IMRT_Field * , IMRT_Buffer * , size_t );
|
||||||
|
IMRT_Status IMR_MM_FML_StrHdl_Field_Value ( IMRT_Field * , IMRT_Field_Value_Id);
|
||||||
|
IMRT_Status IMR_MM_FML_StrHdl_Field_Exist ( IMRT_Field * );
|
||||||
|
IMRT_Status IMR_MM_FML_StrHdl_Msg_Size ( size_t );
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
extern IMRT_Status MM_FML_StrHdl_Init ( void );
|
||||||
|
extern IMRT_Status MM_FML_StrHdl_DeInit ( void );
|
||||||
|
extern IMRT_Status MM_FML_StrHdl_Data_Free ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_FML_StrHdl_Ident ( IMRT_Msg_Id * , IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_FML_StrHdl_Open ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_FML_StrHdl_Close ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_FML_StrHdl_Flush ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_FML_StrHdl_Data_List ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_FML_StrHdl_Copy ( IMRT_Buffer * , IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_FML_StrHdl_Get (IMRT_Buffer_Data ** , IMRT_Field * , IMRT_Buffer * , size_t * );
|
||||||
|
extern IMRT_Status MM_FML_StrHdl_Convert (IMRT_Buffer_Data ** , IMRT_Buffer_Data * , IMRT_Field * , size_t *, IMRT_StrHdl_Cnv_Func * );
|
||||||
|
extern IMRT_Status MM_FML_StrHdl_Put (IMRT_Buffer_Data * , IMRT_Field * , IMRT_Buffer * , size_t );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
1260
src/libmapping_mng/src/fmt_hdl_xml.c
Normal file
1260
src/libmapping_mng/src/fmt_hdl_xml.c
Normal file
File diff suppressed because it is too large
Load Diff
135
src/libmapping_mng/src/fmt_hdl_xml.h
Normal file
135
src/libmapping_mng/src/fmt_hdl_xml.h
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: fmt_hdl_xml.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _XML_HANDLER_H_
|
||||||
|
#define _XML_HANDLER_H_
|
||||||
|
|
||||||
|
#include <libxml/tree.h>
|
||||||
|
#include <libxml/xpath.h>
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "libmapping_mng.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _XML_HANDLER_C_
|
||||||
|
|
||||||
|
# define IMRD_XML_VERSION "1.0"
|
||||||
|
# define IMRD_XML_BALISE "/"
|
||||||
|
# define IMRD_SOON_SIZE 100
|
||||||
|
# define IMRD_FIRST_NODE 0
|
||||||
|
# define IMRD_FATHER_SIZE 100
|
||||||
|
# define IMRD_ATTIBUTE_SIZE 100
|
||||||
|
|
||||||
|
typedef int IMRT_NB_FATHER ;
|
||||||
|
typedef char ** IMRT_FATHER_TABLE;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_PARSE_PATH_XML
|
||||||
|
{
|
||||||
|
IMRT_NB_FATHER Nb_Father;
|
||||||
|
IMRT_Status Attribute_present;
|
||||||
|
IMRT_FATHER_TABLE Father_Table;
|
||||||
|
char Soon_Name[IMRD_SOON_SIZE];
|
||||||
|
char Attribute_Name[IMRD_ATTIBUTE_SIZE];
|
||||||
|
char Attribute_Value[IMRD_ATTIBUTE_SIZE];
|
||||||
|
|
||||||
|
}IMRT_PARSE_PATH_XML;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _XML_HANDLER_C_
|
||||||
|
|
||||||
|
IMRT_Buffer *IMRG_XML_Buffer_Ident_Ptr;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _XML_HANDLER_C_
|
||||||
|
|
||||||
|
IMRT_Status MM_XML_StrHdl_Init ( void );
|
||||||
|
IMRT_Status MM_XML_StrHdl_DeInit ( void );
|
||||||
|
IMRT_Status XML_Hdl_DataTemp_Alloc ( IMRT_Buffer * );
|
||||||
|
IMRT_Status XML_Hdl_DataTemp_Free ( IMRT_Buffer * );
|
||||||
|
IMRT_Status XML_Hdl_DataBuf_Free ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_XML_StrHdl_Data_Free ( IMRT_Buffer * );
|
||||||
|
IMRT_Status XML_Hdl_Format_Ident ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_XML_StrHdl_Ident ( IMRT_Msg_Id * , IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_XML_StrHdl_Open ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_XML_StrHdl_Close ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_XML_StrHdl_Flush ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_XML_StrHdl_Data_List ( IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_XML_StrHdl_Copy ( IMRT_Buffer * , IMRT_Buffer * );
|
||||||
|
IMRT_Status XML_Hdl_Field_Exist ( IMRT_Field * , IMRT_Buffer * );
|
||||||
|
IMRT_Status MM_XML_StrHdl_Get ( IMRT_Buffer_Data ** , IMRT_Field * , IMRT_Buffer * , size_t * );
|
||||||
|
IMRT_Status MM_XML_StrHdl_Convert ( IMRT_Buffer_Data ** , IMRT_Buffer_Data * , IMRT_Field * , size_t *, IMRT_StrHdl_Cnv_Func * );
|
||||||
|
IMRT_Status MM_XML_StrHdl_Put ( IMRT_Buffer_Data * , IMRT_Field * , IMRT_Buffer * , size_t );
|
||||||
|
IMRT_Status IMR_MM_XML_StrHdl_Field_Value ( IMRT_Field * , IMRT_Field_Value_Id);
|
||||||
|
IMRT_Status IMR_MM_XML_StrHdl_Field_Exist ( IMRT_Field * );
|
||||||
|
IMRT_Status IMR_MM_XML_StrHdl_Msg_Size ( size_t );
|
||||||
|
IMRT_Status MM_XML_DInit_StructPath (IMRT_PARSE_PATH_XML * );
|
||||||
|
IMRT_Status MM_XML_Proceed_Path ( IMRT_PARSE_PATH_XML * , IMRT_Buffer_Data * , xmlDocPtr );
|
||||||
|
IMRT_Status MM_XML_Split_Path ( IMRT_Buffer_Data * Chaine_Ptr , IMRT_PARSE_PATH_XML * PathXml_Ptr );
|
||||||
|
IMRT_Status MM_XML_SplitAttribute ( IMRT_PARSE_PATH_XML * PathXml_Ptr );
|
||||||
|
#else
|
||||||
|
|
||||||
|
extern IMRT_Status MM_XML_StrHdl_Init ( void );
|
||||||
|
extern IMRT_Status MM_XML_StrHdl_DeInit ( void );
|
||||||
|
extern IMRT_Status MM_XML_StrHdl_Data_Free ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_XML_StrHdl_Ident ( IMRT_Msg_Id * , IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_XML_StrHdl_Open ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_XML_StrHdl_Close ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_XML_StrHdl_Flush ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_XML_StrHdl_Data_List ( IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_XML_StrHdl_Copy ( IMRT_Buffer * , IMRT_Buffer * );
|
||||||
|
extern IMRT_Status MM_XML_StrHdl_Get ( IMRT_Buffer_Data ** , IMRT_Field * , IMRT_Buffer * , size_t * );
|
||||||
|
extern IMRT_Status MM_XML_StrHdl_Convert ( IMRT_Buffer_Data ** , IMRT_Buffer_Data * , IMRT_Field * , size_t *, IMRT_StrHdl_Cnv_Func * );
|
||||||
|
extern IMRT_Status MM_XML_StrHdl_Put ( IMRT_Buffer_Data * , IMRT_Field * , IMRT_Buffer * , size_t );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
259
src/libmapping_mng/src/libmapping_mng.c
Normal file
259
src/libmapping_mng/src/libmapping_mng.c
Normal file
@ -0,0 +1,259 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* $Workfile: libmapping_mng.c $ */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* $Author: agibert $ */
|
||||||
|
/* $Date: 2008/11/12 02:25:23 $ */
|
||||||
|
/* $Revision: 1.1 $ */
|
||||||
|
/* $Label: $ */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBMAPPING_MNG_
|
||||||
|
#define _LIBMAPPING_MNG_C_
|
||||||
|
|
||||||
|
#include "libmapping_mng.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Mapping Manager API */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Open Mapping Manager */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_MM_Library_Open( IMRT_MM_Config *Config)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
|
||||||
|
|
||||||
|
if( IMRG_MM_Module.Lib.Status != IMRD_LIB_STATUS_CLOSED)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0( "Library not closed !");
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRG_MM_Base.Config.XML_Format = Config->XML_Format;
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
status = MM_Schedul_Init( );
|
||||||
|
|
||||||
|
if (status != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Error MM_Schedul_Init in IMR_MM_Library_Open");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = MM_Buffer_Init( ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if( status != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0( "Can't open library !");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRG_MM_Module.Lib.Status = IMRD_LIB_STATUS_OPENED;
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_1, "Library opened !");
|
||||||
|
}
|
||||||
|
|
||||||
|
return( status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Close Mapping Manager */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_MM_Library_Close()
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
|
||||||
|
|
||||||
|
if( IMRG_MM_Module.Lib.Status != IMRD_LIB_STATUS_OPENED)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0( "Library not opened !");
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
status = MM_Schedul_DeInit( );
|
||||||
|
|
||||||
|
if (status != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Error MM_Schedul_DeInit in IMR_MM_Library_Close");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = MM_Buffer_DeInit( ) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( status != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0( "Can't close library !");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRG_MM_Module.Lib.Status = IMRD_LIB_STATUS_CLOSED;
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_1, "Library closed !");
|
||||||
|
}
|
||||||
|
|
||||||
|
return( status) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer allocation */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (O) Buffer_Ptr_Ptr : Buffer pointer pointer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_MM_Buffer_Alloc( IMRT_Buffer **Buffer_Ptr_Ptr)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
status = MM_Buffer_Alloc( Buffer_Ptr_Ptr ) ;
|
||||||
|
|
||||||
|
if (status != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Error MM_Buffer_Alloc");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_1, "Allocated buffer success");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (status) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer free */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (IO) Buffer_Ptr_Ptr : Buffer pointer pointer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_MM_Buffer_Free( IMRT_Buffer **Buffer_Ptr_Ptr)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
status = MM_Buffer_Free( Buffer_Ptr_Ptr ) ;
|
||||||
|
|
||||||
|
if (status != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Error MM_Buffer_Free");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_1, "Freed buffer success");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (status) ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer check */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Buffer_Ptr : Buffer pointer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_MM_Buffer_Check (IMRT_Buffer *Buffer_Ptr)
|
||||||
|
{
|
||||||
|
|
||||||
|
IMRT_Status status;
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
status = MM_Buffer_Check( Buffer_Ptr ) ;
|
||||||
|
|
||||||
|
if (status != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Error MM_Buffer_Check in IMR_MM_Buffer_Check");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_1, "Check buffer success");
|
||||||
|
}
|
||||||
|
|
||||||
|
return (status) ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer list */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Buffer_Ptr : Buffer pointer */
|
||||||
|
/* (I) texte : Text to print */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_MM_Buffer_List( IMRT_Buffer *Buffer_Ptr, char *texte)
|
||||||
|
{
|
||||||
|
return( MM_Buffer_List( Buffer_Ptr, texte ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer mapping */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Output_Buffer_Ptr : Output buffer pointer */
|
||||||
|
/* (I) Input_Buffer_Ptr : Input buffer pointer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_MM_Buffer_Map( IMRT_Buffer *Output_Buffer_Ptr, IMRT_Buffer *Input_Buffer_Ptr)
|
||||||
|
{
|
||||||
|
return ( MM_Schedul_Buffer_Map( Output_Buffer_Ptr, Input_Buffer_Ptr ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
142
src/libmapping_mng/src/libmapping_mng.h
Normal file
142
src/libmapping_mng/src/libmapping_mng.h
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: libmapping_mng.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _LIBMAPPING_MNG_H_
|
||||||
|
#define _LIBMAPPING_MNG_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <imr.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Lib Definitions */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_MM_MODULE_ID ( IMRT_Module_Id) 4
|
||||||
|
#define IMRD_MM_MODULE_NAME ( IMRT_Module_Name) "mm"
|
||||||
|
#define IMRD_MM_MODULE_NAME_LONG ( IMRT_Module_Name_Long) "Mapping Manager"
|
||||||
|
#define IMRD_MM_MODULE_VERSION ( IMRT_Module_Version) "@(#) VERSIONIMR: $Label: $ $Date: 2008/11/12 02:25:23 $ $Workfile: libmapping_mng.h $"
|
||||||
|
|
||||||
|
#define IMRD_MODULE_PTR &IMRG_MM_Module
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_STATUS_NOTHING_TO_DO (IMRT_Status) 4
|
||||||
|
|
||||||
|
typedef IMRT_Status (IMRT_MM_Cnv_Init)( void );
|
||||||
|
typedef IMRT_Status (IMRT_MM_Cnv_DeInit)( void );
|
||||||
|
typedef IMRT_Status (IMRT_MM_Convert)( IMRT_Buffer_Data * , IMRT_Buffer_Data * , size_t * , size_t , IMRT_Cnv_Attr );
|
||||||
|
|
||||||
|
typedef struct IMRT_StrHdl_Cnv_Func
|
||||||
|
|
||||||
|
{ IMRT_Cnv_Name Nom;
|
||||||
|
IMRT_MM_Cnv_Init *Init_Ptr;
|
||||||
|
IMRT_MM_Cnv_DeInit *DeInit_Ptr;
|
||||||
|
IMRT_MM_Convert *Convert_Ptr;
|
||||||
|
} IMRT_StrHdl_Cnv_Func;
|
||||||
|
|
||||||
|
/* a virer apres les tests */
|
||||||
|
IMRT_StrHdl_Cnv_Func *IMRG_MM_StrHdl_Cnv_Func_Tab;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_MM_Base
|
||||||
|
{
|
||||||
|
IMRT_MM_Config Config;
|
||||||
|
} IMRT_MM_Base;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBMAPPING_MNG_C_
|
||||||
|
|
||||||
|
IMRT_MM_Base IMRG_MM_Base =
|
||||||
|
{
|
||||||
|
{ IMRD_FALSE}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Module IMRG_MM_Module =
|
||||||
|
{
|
||||||
|
IMRD_MM_MODULE_ID,
|
||||||
|
IMRD_MM_MODULE_NAME,
|
||||||
|
IMRD_MM_MODULE_NAME_LONG,
|
||||||
|
IMRD_MM_MODULE_VERSION,
|
||||||
|
IMRD_MODULE_TYPE_LIBRARY,
|
||||||
|
{
|
||||||
|
IMRD_LIB_STATUS_CLOSED,
|
||||||
|
( IMRT_Lib_Open *) &IMR_MM_Library_Open,
|
||||||
|
( IMRT_Lib_Close *) &IMR_MM_Library_Close
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
extern IMRT_MM_Base IMRG_MM_Base;
|
||||||
|
extern IMRT_Module IMRG_MM_Module;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
484
src/libmapping_mng/src/map_scheduler.c
Normal file
484
src/libmapping_mng/src/map_scheduler.c
Normal file
@ -0,0 +1,484 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: map_scheduler.c */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBMAPPING_MNG_
|
||||||
|
#define _MAP_SCHEDULER_C_
|
||||||
|
|
||||||
|
#include "map_scheduler.h"
|
||||||
|
|
||||||
|
IMRT_Status MM_Schedul_Buffer_Map( IMRT_Buffer *Output_Buffer_Ptr, IMRT_Buffer *Input_Buffer_Ptr)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
short indice;
|
||||||
|
IMRT_Fmt_Id format_temp;
|
||||||
|
char *func_name = "MM_Schedul_Buffer_Map";
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
indice = 0;
|
||||||
|
format_temp = Input_Buffer_Ptr->Fmt_Id;
|
||||||
|
|
||||||
|
/* controles sur les buffers */
|
||||||
|
status = Schedul_Buffers_Check(Input_Buffer_Ptr, Output_Buffer_Ptr);
|
||||||
|
|
||||||
|
/* fermeture des buffers */
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
status = MM_Buffer_Close(Input_Buffer_Ptr);
|
||||||
|
}
|
||||||
|
if (status != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer input close failed");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = MM_Buffer_Close(Output_Buffer_Ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer output close failed");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* initialisation du tableau */
|
||||||
|
Buffer_Tab[0] = Input_Buffer_Ptr;
|
||||||
|
Buffer_Tab[1] = Output_Buffer_Ptr;
|
||||||
|
for (indice = 2; indice < IMRT_BUFFER_ID_MAX_NB; indice++)
|
||||||
|
Buffer_Tab[indice] = NULL;
|
||||||
|
|
||||||
|
Input_Buffer_Ptr->Fmt_Id = IMRD_FMT_ID_UNKNOWN ;
|
||||||
|
status = MM_Buffer_Open( Input_Buffer_Ptr );
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_2 , "Values before MapMath proceed begin :");
|
||||||
|
IMRD_LM_LOG_TRACE_3(IMRD_LOG_LEVEL_VERBOSE_2 , "Output Application : Id (%d) Fmt_Id (%d) Msg type Id (%d)" , Output_Buffer_Ptr->Appl_Id_Output , Output_Buffer_Ptr->Fmt_Id , Output_Buffer_Ptr->Msg_Id);
|
||||||
|
IMRD_LM_LOG_TRACE_3(IMRD_LOG_LEVEL_VERBOSE_2 , "Input Application : Id (%d) Fmt_Id (%d) Msg type Id (%d)" , Input_Buffer_Ptr->Appl_Id_Input , Input_Buffer_Ptr->Fmt_Id , Input_Buffer_Ptr->Msg_Id);
|
||||||
|
|
||||||
|
|
||||||
|
if (status != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer input open failed");
|
||||||
|
Input_Buffer_Ptr->Fmt_Id = format_temp;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = IMR_SDM_MapPath_Proceed( Input_Buffer_Ptr->Appl_Id_Output,
|
||||||
|
Output_Buffer_Ptr->Fmt_Id,
|
||||||
|
Output_Buffer_Ptr->Msg_Id,
|
||||||
|
Input_Buffer_Ptr->Appl_Id_Input,
|
||||||
|
Input_Buffer_Ptr->Fmt_Id,
|
||||||
|
Input_Buffer_Ptr->Msg_Id,
|
||||||
|
IMR_MM_Schedul_Map,
|
||||||
|
IMR_MM_Schedul_Copy,
|
||||||
|
IMR_MM_Schedul_Ident);
|
||||||
|
if (status != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1("MapPath proceed ended with status (%d)", status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
indice = 2;
|
||||||
|
while (indice < IMRT_BUFFER_ID_MAX_NB)
|
||||||
|
{
|
||||||
|
if (Buffer_Tab[indice] != NULL)
|
||||||
|
{
|
||||||
|
if (MM_Buffer_Free(&Buffer_Tab[indice]) != IMRS_OK)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_1("Buffer (%d) free failed" , indice);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
indice++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MM_Buffer_Close(Input_Buffer_Ptr) != IMRS_OK)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer input close failed");
|
||||||
|
}
|
||||||
|
if (MM_Buffer_Close(Output_Buffer_Ptr) != IMRS_OK)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Buffer output close failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
Buffer_Tab[0] = NULL;
|
||||||
|
Buffer_Tab[1] = NULL;
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status Schedul_Buffers_Check( IMRT_Buffer *Input_Buffer_Ptr, IMRT_Buffer *Output_Buffer_Ptr)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
char *func_name = "Schedul_Buffers_Check";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (Input_Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Input buffer pointer NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (Output_Buffer_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Output buffer pointer NULL");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (MM_Buffer_Check(Input_Buffer_Ptr) != IMRS_OK)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Check buffer input failed");
|
||||||
|
}
|
||||||
|
if (MM_Buffer_Check(Output_Buffer_Ptr) != IMRS_OK)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Check buffer output failed");
|
||||||
|
}
|
||||||
|
if (Input_Buffer_Ptr->Appl_Id_Input == IMRD_APPL_ID_UNDEFINEDED)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Application input buffer equal to undefineded");
|
||||||
|
}
|
||||||
|
if (Input_Buffer_Ptr->Status != IMRD_BUFFER_STATUS_ALLOCATED)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Status input buffer equal to unknown");
|
||||||
|
}
|
||||||
|
if (Input_Buffer_Ptr->Data_Buf_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Data_Buf_Ptr input buffer equal to NULL");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status IMR_MM_Schedul_Ident( IMRT_Fmt_Id *Format_Ptr,
|
||||||
|
IMRT_Msg_Id *Type,
|
||||||
|
IMRT_Buffer_Id Ident_Buffer_Indice,
|
||||||
|
IMRT_Boolean Ident_Total )
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
IMRT_Msg_Id TypeTmp;
|
||||||
|
char *func_name = "IMR_MM_Schedul_Ident";
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "============================================================================")
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "Ident buffer demand : Begin");
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Ident buffer demand : Buffer : (%d)" , Ident_Buffer_Indice);
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Ident buffer demand : Format Id : (%d)" , *Format_Ptr);
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Ident buffer demand : Msg type : (%d)" , *Type);
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Ident buffer demand : Total ident : (%d)" , Ident_Total);
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
TypeTmp = IMRD_MSG_ID_UNKNOWN;
|
||||||
|
|
||||||
|
/* controle valeur de l'indice */
|
||||||
|
if ( ( Ident_Buffer_Indice < 0 ) || ( Ident_Buffer_Indice >= IMRT_BUFFER_ID_MAX_NB ) )
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_1("Buffer (%d) out of bounds" , Ident_Buffer_Indice);
|
||||||
|
}
|
||||||
|
/* controle allocation d'un buffer pour l'indice */
|
||||||
|
else if ( Buffer_Tab[Ident_Buffer_Indice] == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_1("Buffer (%d) not allocated" , Ident_Buffer_Indice);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TypeTmp = Buffer_Tab[Ident_Buffer_Indice]->Msg_Id;
|
||||||
|
|
||||||
|
if (Ident_Total == IMRD_TRUE) // identification totale
|
||||||
|
{
|
||||||
|
status = MM_Buffer_Ident_Update(Buffer_Tab[Ident_Buffer_Indice],
|
||||||
|
IMRD_FMT_ID_UNKNOWN,
|
||||||
|
IMRD_FMTATTR_NAME_UNKNOWN,
|
||||||
|
IMRD_MSG_ID_UNKNOWN);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( status != IMRS_OK )
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("MM_Buffer_Ident_Update failed");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = MM_Buffer_Open ( Buffer_Tab[Ident_Buffer_Indice] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( status != IMRS_OK )
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1("Buffer (%d) not open" , Ident_Buffer_Indice);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = MM_Buffer_Ident ( *Type , Buffer_Tab[Ident_Buffer_Indice] );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("MM_Buffer_Ident failed");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*Format_Ptr = Buffer_Tab[Ident_Buffer_Indice]->Fmt_Id;
|
||||||
|
*Type = Buffer_Tab[Ident_Buffer_Indice]->Msg_Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ((status != IMRS_OK) && (status != IMRS_KO))
|
||||||
|
{
|
||||||
|
status = IMRS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
MM_Buffer_List( Buffer_Tab[Ident_Buffer_Indice], " CB Ident end");
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Ident buffer demand end : Format Id : (%d)" , *Format_Ptr);
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Ident buffer demand end : Msg type : (%d)" , *Type);
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Ident buffer demand : End with status : (%d)" , status);
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "============================================================================")
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status IMR_MM_Schedul_Copy( IMRT_Buffer_Id Output_Buffer_Indice, IMRT_Buffer_Id Input_Buffer_Indice)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
IMRT_Buffer *buffer_ptr;
|
||||||
|
char *func_name = "IMR_MM_Schedul_Copy";
|
||||||
|
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "============================================================================")
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "Copy buffer demand : Begin");
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Copy buffer demand : Buffer Target : (%d)" , Output_Buffer_Indice);
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Copy buffer demand : Buffer Source : (%d)" , Input_Buffer_Indice);
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
buffer_ptr = NULL;
|
||||||
|
|
||||||
|
/* controle la validite des indices */
|
||||||
|
if ( ( Input_Buffer_Indice < 0 ) || ( Input_Buffer_Indice >= IMRT_BUFFER_ID_MAX_NB ) ||
|
||||||
|
( Output_Buffer_Indice < 0 ) || ( Output_Buffer_Indice >= IMRT_BUFFER_ID_MAX_NB ) )
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_2("Buffer input with indice (%d) or output with indice (%d) out of bounds" , Input_Buffer_Indice , Output_Buffer_Indice);
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else if ( Buffer_Tab[Input_Buffer_Indice] == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_1("Buffer with indice (%d) not initialized" , Input_Buffer_Indice);
|
||||||
|
}
|
||||||
|
/* allocation du buffer destinataire si necessaire */
|
||||||
|
else if ( Buffer_Tab[Output_Buffer_Indice] == NULL)
|
||||||
|
{
|
||||||
|
status = MM_Buffer_Alloc(&buffer_ptr);
|
||||||
|
if (status != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0("Error MM_Buffer_Alloc");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Buffer_Tab[Output_Buffer_Indice] = buffer_ptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MM_Buffer_List( Buffer_Tab[Input_Buffer_Indice], " Before Copy Buffer In");
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
status = MM_Buffer_Copy( Buffer_Tab[Output_Buffer_Indice], Buffer_Tab[Input_Buffer_Indice]);
|
||||||
|
}
|
||||||
|
MM_Buffer_List( Buffer_Tab[Output_Buffer_Indice], " After Copy Buffer Out");
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Copy buffer demand : End with status : (%d)" , status);
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "============================================================================")
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer Mapping CallBack */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Buffer_Id_Target: Target buffer id */
|
||||||
|
/* (I) Fmt_Target: Target format */
|
||||||
|
/* (I) Buffer_Id_Src: Source buffer id */
|
||||||
|
/* (I) Fmt_Src: Source format */
|
||||||
|
/* (I) MsgMap: Message Map to use */
|
||||||
|
/* (I) Clear_Flag: Clear or not output buffer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_MM_Schedul_Map( IMRT_Buffer_Id Buffer_Id_Target ,
|
||||||
|
IMRT_Fmt_Id Fmt_Target,
|
||||||
|
IMRT_FmtAttr_Value Fmt_Target_Attr ,
|
||||||
|
IMRT_Buffer_Id Buffer_Id_Src ,
|
||||||
|
IMRT_Fmt_Id Fmt_Src ,
|
||||||
|
IMRT_FmtAttr_Value Fmt_Src_Attr ,
|
||||||
|
IMRT_MsgMap *MsgMap_ptr ,
|
||||||
|
IMRT_MapCmd_Flag Clear_Flag)
|
||||||
|
|
||||||
|
{
|
||||||
|
IMRT_Buffer *input_buffer_ptr,
|
||||||
|
*output_buffer_ptr;
|
||||||
|
IMRT_Status status;
|
||||||
|
char *func_name = "IMR_MM_Schedul_Map";
|
||||||
|
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
input_buffer_ptr = NULL;
|
||||||
|
output_buffer_ptr = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
/* controle buffers */
|
||||||
|
if ( ( Buffer_Id_Src < 0 ) || ( Buffer_Id_Src >= IMRT_BUFFER_ID_MAX_NB ) ||
|
||||||
|
( Buffer_Id_Target < 0 ) || ( Buffer_Id_Target >= IMRT_BUFFER_ID_MAX_NB ) )
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_2("Indices buffer input (%d) or output (%d) out of bounds" , Buffer_Id_Src,Buffer_Id_Target);
|
||||||
|
}
|
||||||
|
else if ( Buffer_Tab[Buffer_Id_Src] == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_1("Buffer with indice (%d) not allocated ",Buffer_Id_Src);
|
||||||
|
}
|
||||||
|
else if (Fmt_Src_Attr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Source format attribute NULL");
|
||||||
|
}
|
||||||
|
else if (Fmt_Target_Attr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Target format attribute NULL");
|
||||||
|
}
|
||||||
|
else if (MsgMap_ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Message map pointer NULL");
|
||||||
|
}
|
||||||
|
else if (MsgMap_ptr->Msg_Input_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Message input pointer NULL");
|
||||||
|
}
|
||||||
|
else if (MsgMap_ptr->Msg_Output_Ptr == NULL)
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
IMRD_LM_LOG_ERROR_0("Message output pointer NULL");
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( status == IMRS_OK )
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "============================================================================")
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "Mapping buffer demand : Begin");
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Mapping buffer demand : MsgMap : (%s)" , (char *) MsgMap_ptr->Name);
|
||||||
|
IMRD_LM_LOG_TRACE_2(IMRD_LOG_LEVEL_VERBOSE_1 , "Mapping buffer demand : indices Buffers : Src (%d) : Tgt (%d)" , Buffer_Id_Src , Buffer_Id_Target);
|
||||||
|
IMRD_LM_LOG_TRACE_2(IMRD_LOG_LEVEL_VERBOSE_1 , "Mapping buffer demand : formats : Src (%d) : Tgt (%d)" , Fmt_Src , Fmt_Target);
|
||||||
|
IMRD_LM_LOG_TRACE_2(IMRD_LOG_LEVEL_VERBOSE_1 , "Mapping buffer demand : Attributs : Src (%s) : Tgt (%s)" , Fmt_Src_Attr , Fmt_Target_Attr);
|
||||||
|
IMRD_LM_LOG_TRACE_2(IMRD_LOG_LEVEL_VERBOSE_1 , "Mapping buffer demand : Types de msg : Src (%s) : Tgt (%s)" , (char *) MsgMap_ptr->Msg_Input_Ptr->Name , (char *) MsgMap_ptr->Msg_Output_Ptr->Name);
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Mapping buffer demand : Flag buffer clear : (%d)" , Clear_Flag);
|
||||||
|
|
||||||
|
input_buffer_ptr = Buffer_Tab[Buffer_Id_Src];
|
||||||
|
if ( Buffer_Tab[Buffer_Id_Target] == NULL)
|
||||||
|
{
|
||||||
|
status = MM_Buffer_Alloc(&output_buffer_ptr);
|
||||||
|
if ( status != IMRS_OK )
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1("MM_Buffer_Alloc failed for buffer output (%d)",Buffer_Id_Target);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Buffer_Tab[Buffer_Id_Target] = output_buffer_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if ( Clear_Flag == IMRD_TRUE )
|
||||||
|
{
|
||||||
|
output_buffer_ptr = Buffer_Tab[Buffer_Id_Target];
|
||||||
|
status = MM_Buffer_Clear(output_buffer_ptr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
output_buffer_ptr = Buffer_Tab[Buffer_Id_Target];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* mise a jour des formats et types des buffers */
|
||||||
|
if ( status == IMRS_OK )
|
||||||
|
{
|
||||||
|
status = MM_Buffer_Ident_Update(input_buffer_ptr,
|
||||||
|
Fmt_Src,
|
||||||
|
Fmt_Src_Attr,
|
||||||
|
MsgMap_ptr->Msg_Input_Ptr->Id);
|
||||||
|
}
|
||||||
|
if ( status == IMRS_OK )
|
||||||
|
{
|
||||||
|
status =MM_Buffer_Ident_Update( output_buffer_ptr,
|
||||||
|
Fmt_Target,
|
||||||
|
Fmt_Target_Attr,
|
||||||
|
MsgMap_ptr->Msg_Output_Ptr->Id);
|
||||||
|
}
|
||||||
|
/* ouverture des buffers */
|
||||||
|
if ( status == IMRS_OK )
|
||||||
|
{
|
||||||
|
status = MM_Buffer_Open( input_buffer_ptr);
|
||||||
|
}
|
||||||
|
if ( status == IMRS_OK )
|
||||||
|
{
|
||||||
|
MM_Buffer_Open( output_buffer_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
MM_Buffer_List( input_buffer_ptr, " Input Buffer Before Mapping");
|
||||||
|
|
||||||
|
if ( status == IMRS_OK )
|
||||||
|
{
|
||||||
|
status = MM_Buffer_Map( output_buffer_ptr, input_buffer_ptr, MsgMap_ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
MM_Buffer_List( output_buffer_ptr, " Output Buffer after Mapping");
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_1(IMRD_LOG_LEVEL_VERBOSE_1 , "Mapping buffer demand : End with status : (%d)" , status);
|
||||||
|
IMRD_LM_LOG_TRACE_0(IMRD_LOG_LEVEL_VERBOSE_1 , "============================================================================")
|
||||||
|
|
||||||
|
return ( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Schedul_Init()
|
||||||
|
{
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRT_Status MM_Schedul_DeInit()
|
||||||
|
{
|
||||||
|
return (IMRS_OK);
|
||||||
|
}
|
88
src/libmapping_mng/src/map_scheduler.h
Normal file
88
src/libmapping_mng/src/map_scheduler.h
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: map_scheduler.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _MAP_SCHEDULER_H_
|
||||||
|
#define _MAP_SCHEDULER_H_
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "libmapping_mng.h"
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifdef _MAP_SCHEDULER_C_
|
||||||
|
|
||||||
|
IMRT_Buffer *Buffer_Tab[IMRT_BUFFER_ID_MAX_NB];
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
#ifdef _MAP_SCHEDULER_C_
|
||||||
|
|
||||||
|
IMRT_Status MM_Schedul_Init ( void );
|
||||||
|
IMRT_Status MM_Schedul_DeInit ( void );
|
||||||
|
IMRT_Status MM_Schedul_Buffer_Map ( IMRT_Buffer * , IMRT_Buffer * );
|
||||||
|
IMRT_Status Schedul_Buffers_Check ( IMRT_Buffer * , IMRT_Buffer * );
|
||||||
|
IMRT_Status IMR_MM_Schedul_Ident ( IMRT_Fmt_Id * , IMRT_Msg_Id *, IMRT_Buffer_Id , IMRT_Boolean );
|
||||||
|
IMRT_Status IMR_MM_Schedul_Copy ( IMRT_Buffer_Id , IMRT_Buffer_Id );
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer Mapping CallBack */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Buffer_Id_Target: Target buffer id */
|
||||||
|
/* (I) Fmt_Target: Target format */
|
||||||
|
/* (I) Fmt_Attr_Target: Target format attribute */
|
||||||
|
/* (I) Buffer_Id_Src: Source buffer id */
|
||||||
|
/* (I) Fmt_Src: Source format */
|
||||||
|
/* (I) Fmt_Attr_Src: Source format attribute */
|
||||||
|
/* (I) MsgMap: Message Map to use */
|
||||||
|
/* (I) Clear_Flag: Clear or donn't clear output buffer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
IMRT_Status IMR_MM_Schedul_Map( IMRT_Buffer_Id, IMRT_Fmt_Id, IMRT_FmtAttr_Value, IMRT_Buffer_Id, IMRT_Fmt_Id, IMRT_FmtAttr_Value, IMRT_MsgMap *, IMRT_MapCmd_Flag);
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
extern IMRT_Status MM_Schedul_Init ( void );
|
||||||
|
extern IMRT_Status MM_Schedul_DeInit ( void );
|
||||||
|
extern IMRT_Status MM_Schedul_Buffer_Map ( IMRT_Buffer * , IMRT_Buffer * );
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
132
src/libmsg_router/include/msg_router.h
Normal file
132
src/libmsg_router/include/msg_router.h
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: msg_router.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _MSG_ROUTER_H_
|
||||||
|
#define _MSG_ROUTER_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <imr.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRD_MR_API definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBMSG_ROUTER_
|
||||||
|
# define IMRD_MR_API
|
||||||
|
# else
|
||||||
|
# define IMRD_MR_API extern
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* MR_Config definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct IMRT_MR_Config
|
||||||
|
{
|
||||||
|
IMRT_Boolean Mapping_Forced;
|
||||||
|
IMRT_Boolean Continue_Forced;
|
||||||
|
IMRT_Read_Mode Read_Mode;
|
||||||
|
IMRT_Log_Id_Struct Log_Id_Struct_Input;
|
||||||
|
IMRT_Log_Id_Struct Log_Id_Struct_Output;
|
||||||
|
} IMRT_MR_Config;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBMSG_ROUTER_
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
extern IMRT_Module IMRG_MR_Module;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Msg Router API */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Open Msg Router */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Lib_Flag: Setup MR init mode */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_MR_API IMRT_Status IMR_MR_Library_Open( IMRT_MR_Config *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Close Msg Router */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_MR_API IMRT_Status IMR_MR_Library_Close( void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Proceed Message Routing */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_URL_Output: Output medium URL */
|
||||||
|
/* Appl_Id_Output: Output application Id */
|
||||||
|
/* Medium_URL_Input: Trash Medium URL */
|
||||||
|
/* Medium_URL_Input: Input Medium URL */
|
||||||
|
/* Appl_Id_Input: Input Application Id */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_MR_API IMRT_Status IMR_MR_Proceed( IMRT_Medium_URL, IMRT_Appl_Id, IMRT_Medium_URL, IMRT_Medium_URL, IMRT_Appl_Id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
65
src/libmsg_router/src/Makefile
Normal file
65
src/libmsg_router/src/Makefile
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Local Makefile
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Workfile: Makefile $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Author: agibert $
|
||||||
|
# $Date: 2008/11/12 02:25:23 $
|
||||||
|
# $Revision: 1.1 $
|
||||||
|
# $Label: $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# IMR - Interlinking Message Router
|
||||||
|
# Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt)
|
||||||
|
# mailto:arnaud@rx3.net
|
||||||
|
# http://www.rx3.org/dvp/?dvp=imr
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# This file is part of IMR
|
||||||
|
#
|
||||||
|
# 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 2
|
||||||
|
# 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, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Var include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include ../../Makefile_var.mk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Variables
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
TARGET= libmsg_router$(SHLIB_SUFFIX)
|
||||||
|
|
||||||
|
OBJ= libmsg_router.o
|
||||||
|
|
||||||
|
EXTRA_INC=
|
||||||
|
|
||||||
|
EXTRA_LIB=
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Rule include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include ../../Makefile_rule.mk
|
544
src/libmsg_router/src/libmsg_router.c
Normal file
544
src/libmsg_router/src/libmsg_router.c
Normal file
@ -0,0 +1,544 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* $Workfile: libmsg_router.c $ */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* $Author: agibert $ */
|
||||||
|
/* $Date: 2008/11/12 02:25:23 $ */
|
||||||
|
/* $Revision: 1.1 $ */
|
||||||
|
/* $Label: $ */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBMSG_ROUTER_
|
||||||
|
#define _LIBMSG_ROUTER_C_
|
||||||
|
|
||||||
|
#include "libmsg_router.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Msg Router API */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Open Msg Router */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Lib_Flag: Setup MR init mode */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_MR_Library_Open( IMRT_MR_Config *Config_Ptr)
|
||||||
|
{
|
||||||
|
int idx;
|
||||||
|
|
||||||
|
|
||||||
|
if( IMRG_MR_Module.Lib.Status != IMRD_LIB_STATUS_CLOSED)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0( "Library not closed !");
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRG_MR_Base.Config.Mapping_Forced = Config_Ptr->Mapping_Forced;
|
||||||
|
IMRG_MR_Base.Config.Continue_Forced = Config_Ptr->Continue_Forced;
|
||||||
|
IMRG_MR_Base.Config.Read_Mode = Config_Ptr->Read_Mode;
|
||||||
|
|
||||||
|
if( Config_Ptr->Log_Id_Struct_Input.Bit_Nb != 0)
|
||||||
|
{
|
||||||
|
IMRG_MR_Base.Config.Log_Id_Struct_Input.Bit_Nb = Config_Ptr->Log_Id_Struct_Input.Bit_Nb;
|
||||||
|
IMRG_MR_Base.Config.Log_Id_Struct_Input.Log_Size = Config_Ptr->Log_Id_Struct_Input.Log_Size;
|
||||||
|
|
||||||
|
if( ( IMRG_MR_Base.Config.Log_Id_Struct_Input.Log_Id_Bit_Ptr =
|
||||||
|
malloc( IMRG_MR_Base.Config.Log_Id_Struct_Input.Bit_Nb * sizeof( IMRT_Log_Id_Bit))) == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't allocate Input Log_Id_Bit_Ptr (%d) !", errno);
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
for( idx = 0; idx < IMRG_MR_Base.Config.Log_Id_Struct_Input.Bit_Nb; idx++)
|
||||||
|
{
|
||||||
|
IMRG_MR_Base.Config.Log_Id_Struct_Input.Log_Id_Bit_Ptr[idx].Offset = Config_Ptr->Log_Id_Struct_Input.Log_Id_Bit_Ptr[idx].Offset;
|
||||||
|
IMRG_MR_Base.Config.Log_Id_Struct_Input.Log_Id_Bit_Ptr[idx].Size = Config_Ptr->Log_Id_Struct_Input.Log_Id_Bit_Ptr[idx].Size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Config_Ptr->Log_Id_Struct_Output.Bit_Nb != 0)
|
||||||
|
{
|
||||||
|
IMRG_MR_Base.Config.Log_Id_Struct_Output.Bit_Nb = Config_Ptr->Log_Id_Struct_Output.Bit_Nb;
|
||||||
|
IMRG_MR_Base.Config.Log_Id_Struct_Output.Log_Size = Config_Ptr->Log_Id_Struct_Output.Log_Size;
|
||||||
|
|
||||||
|
if( ( IMRG_MR_Base.Config.Log_Id_Struct_Output.Log_Id_Bit_Ptr =
|
||||||
|
malloc( IMRG_MR_Base.Config.Log_Id_Struct_Output.Bit_Nb * sizeof( IMRT_Log_Id_Bit))) == NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't allocate Output Log_Id_Bit_Ptr (%d) !", errno);
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
for( idx = 0; idx < IMRG_MR_Base.Config.Log_Id_Struct_Output.Bit_Nb; idx++)
|
||||||
|
{
|
||||||
|
IMRG_MR_Base.Config.Log_Id_Struct_Output.Log_Id_Bit_Ptr[idx].Offset = Config_Ptr->Log_Id_Struct_Output.Log_Id_Bit_Ptr[idx].Offset;
|
||||||
|
IMRG_MR_Base.Config.Log_Id_Struct_Output.Log_Id_Bit_Ptr[idx].Size = Config_Ptr->Log_Id_Struct_Output.Log_Id_Bit_Ptr[idx].Size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRG_MR_Module.Lib.Status = IMRD_LIB_STATUS_OPENED;
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_1, "Library opened !");
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Close Msg Router */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_MR_Library_Close()
|
||||||
|
{
|
||||||
|
if( IMRG_MR_Module.Lib.Status != IMRD_LIB_STATUS_OPENED)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_0( "Library not opened !");
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( IMRG_MR_Base.Config.Log_Id_Struct_Input.Bit_Nb != 0)
|
||||||
|
{
|
||||||
|
free( IMRG_MR_Base.Config.Log_Id_Struct_Input.Log_Id_Bit_Ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( IMRG_MR_Base.Config.Log_Id_Struct_Output.Bit_Nb != 0)
|
||||||
|
{
|
||||||
|
free( IMRG_MR_Base.Config.Log_Id_Struct_Output.Log_Id_Bit_Ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRG_MR_Module.Lib.Status = IMRD_LIB_STATUS_CLOSED;
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_1, "Library closed !");
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Close all allocated resources */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer_Input_Ptr: Input buffer */
|
||||||
|
/* Buffer_Output_Ptr: Output buffer */
|
||||||
|
/* Medium_Input_Ptr: Input Medium */
|
||||||
|
/* Medium_Output_Ptr: Output Medium */
|
||||||
|
/* Medium_Trash_Ptr: Output Medium */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status Close_All( IMRT_Buffer *Buffer_Input_Ptr, IMRT_Buffer *Buffer_Output_Ptr,
|
||||||
|
IMRT_Medium *Medium_Input_Ptr, IMRT_Medium *Medium_Output_Ptr, IMRT_Medium *Medium_Trash_Ptr)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
|
||||||
|
|
||||||
|
if( Buffer_Output_Ptr != NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Freeing output buffer...");
|
||||||
|
|
||||||
|
if( ( status = IMR_MM_Buffer_Free( &Buffer_Output_Ptr)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't free output buffer (%d) !", status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Buffer_Input_Ptr != NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Freeing input buffer...");
|
||||||
|
|
||||||
|
if( ( status = IMR_MM_Buffer_Free( &Buffer_Input_Ptr)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't free input buffer (%d) !", status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Medium_Trash_Ptr != NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Closing trash medium...");
|
||||||
|
|
||||||
|
if( ( status = IMR_IOM_Medium_Close( Medium_Trash_Ptr)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't close trash medium (%d) !", status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Medium_Output_Ptr != NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Closing output medium...");
|
||||||
|
|
||||||
|
if( ( status = IMR_IOM_Medium_Close( Medium_Output_Ptr)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't close output medium (%d) !", status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Medium_Input_Ptr != NULL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Closing input medium...");
|
||||||
|
|
||||||
|
if( ( status = IMR_IOM_Medium_Close( Medium_Input_Ptr)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't close input medium (%d) !", status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Proceed Message Routing */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Medium_URL_Output: Output medium URL */
|
||||||
|
/* Appl_Id_Output: Output application Id */
|
||||||
|
/* Medium_URL_Input: Input Medium URL */
|
||||||
|
/* Appl_Id_Input: Input Application Id */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status IMR_MR_Proceed( IMRT_Medium_URL Medium_URL_Output, IMRT_Appl_Id Appl_Id_Output,
|
||||||
|
IMRT_Medium_URL Medium_URL_Trash,
|
||||||
|
IMRT_Medium_URL Medium_URL_Input, IMRT_Appl_Id Appl_Id_Input)
|
||||||
|
{
|
||||||
|
IMRT_Status status, return_status = IMRS_OK;
|
||||||
|
IMRT_Boolean data = IMRD_TRUE;
|
||||||
|
IMRT_Appl_Id appl_id_raw;
|
||||||
|
IMRT_Buffer *buffer_input_ptr = NULL, *buffer_output_ptr = NULL;
|
||||||
|
IMRT_Medium *medium_input_ptr = NULL, *medium_output_ptr = NULL, *medium_trash_ptr = NULL;
|
||||||
|
IMRT_Tran *tran_ptr = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
if( sigsetjmp( IMRG_Base.SigLongJmp_Env, 1) != 0 )
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_1( IMRD_LOG_LEVEL_VERBOSE_0, "Exiting on signal (%d)...", IMRG_Base.Sig_Trapped);
|
||||||
|
|
||||||
|
Close_All( buffer_input_ptr, buffer_output_ptr, medium_input_ptr, medium_output_ptr, medium_trash_ptr);
|
||||||
|
|
||||||
|
return( IMRS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( IMR_SDM_Appl_Id_Get( &appl_id_raw, "raw") != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't get Appl_Id from [%s] !", "raw");
|
||||||
|
|
||||||
|
return( IMRS_KO);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Opening input medium...");
|
||||||
|
|
||||||
|
if( ( status = IMR_IOM_Medium_Open( &medium_input_ptr, "Input", Medium_URL_Input, Appl_Id_Input, Appl_Id_Output, IMRD_DIR_ID_IN)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't open input medium (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Opening output medium...");
|
||||||
|
|
||||||
|
if( ( status = IMR_IOM_Medium_Open( &medium_output_ptr, "Output", Medium_URL_Output, Appl_Id_Input, Appl_Id_Output, IMRD_DIR_ID_OUT)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't open output medium (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( IMRG_MR_Base.Config.Continue_Forced == IMRD_TRUE)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Opening trash medium...");
|
||||||
|
|
||||||
|
if( ( status = IMR_IOM_Medium_Open( &medium_trash_ptr, "Trash", Medium_URL_Trash, appl_id_raw, appl_id_raw, IMRD_DIR_ID_OUT)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't open trash medium (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( return_status == IMRS_OK)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Allocating input buffer...");
|
||||||
|
|
||||||
|
if( ( status = IMR_MM_Buffer_Alloc( &buffer_input_ptr)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't allocate input buffer (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Begining transaction...");
|
||||||
|
|
||||||
|
if( ( status = IMR_IOM_Tran_Begin( &tran_ptr, 2, medium_output_ptr, medium_input_ptr)) == IMRS_KO)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't begin transaction (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Reading input medium...");
|
||||||
|
|
||||||
|
if( ( status = IMR_IOM_Medium_Read( buffer_input_ptr, medium_input_ptr, IMRG_MR_Base.Config.Read_Mode)) == IMRS_KO)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't read input buffer (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( status == IMRS_NO_DATA)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "No more data to read...");
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Rollbaking transaction...");
|
||||||
|
|
||||||
|
if( ( status = IMR_IOM_Tran_Rollback( tran_ptr)) == IMRS_KO)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't rollback transaction (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return_status = IMRS_NO_DATA;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( status == IMRS_SIGNAL)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Read interupted by a signal !");
|
||||||
|
|
||||||
|
return_status = status;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMR_MM_Buffer_List( buffer_input_ptr, "Input Buffer");
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Allocating output buffer...");
|
||||||
|
|
||||||
|
if( ( status = IMR_MM_Buffer_Alloc( &buffer_output_ptr)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't allocate output buffer (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Maping input buffer to output buffer...");
|
||||||
|
|
||||||
|
if( ( status = IMR_MM_Buffer_Map( buffer_output_ptr, buffer_input_ptr)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't map buffers (%d) !", status);
|
||||||
|
|
||||||
|
if( IMRG_MR_Base.Config.Mapping_Forced == IMRD_TRUE)
|
||||||
|
{
|
||||||
|
data = IMRD_TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data = IMRD_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( IMRG_MR_Base.Config.Continue_Forced == IMRD_TRUE)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Writing trash medium...");
|
||||||
|
|
||||||
|
if( ( status = IMR_IOM_Medium_Write( medium_trash_ptr, buffer_input_ptr)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't write input buffer (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data = IMRD_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
IMR_MM_Buffer_List( buffer_output_ptr, "Output Buffer");
|
||||||
|
|
||||||
|
if( data == IMRD_TRUE)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Writing output medium...");
|
||||||
|
|
||||||
|
if( ( status = IMR_IOM_Medium_Write( medium_output_ptr, buffer_output_ptr)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't write output buffer (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( return_status != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Rollbaking transaction...");
|
||||||
|
|
||||||
|
if( ( status = IMR_IOM_Tran_Rollback( tran_ptr)) == IMRS_KO)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't rollback transaction (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Comiting transaction...");
|
||||||
|
|
||||||
|
if( ( status = IMR_IOM_Tran_Commit( tran_ptr)) == IMRS_KO)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't commit transaction (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRD_LM_LOG_BUFFER_ID( buffer_input_ptr, &IMRG_MR_Base.Config.Log_Id_Struct_Input, IMRD_MR_LOG_ID_HEADER_MSG_INPUT);
|
||||||
|
IMRD_LM_LOG_BUFFER_ID( buffer_output_ptr, &IMRG_MR_Base.Config.Log_Id_Struct_Output, IMRD_MR_LOG_ID_HEADER_MSG_OUTPUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Freeing output buffer...");
|
||||||
|
|
||||||
|
if( ( status = IMR_MM_Buffer_Free( &buffer_output_ptr)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't free output buffer (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer_output_ptr = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Freeing input buffer...");
|
||||||
|
|
||||||
|
if( ( status = IMR_MM_Buffer_Free( &buffer_input_ptr)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't free input buffer (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer_input_ptr = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while( ( return_status == IMRS_OK) && ( IMRG_Base.Sig_Trapped == 0));
|
||||||
|
|
||||||
|
switch( return_status)
|
||||||
|
{
|
||||||
|
case IMRS_OK:
|
||||||
|
case IMRS_NO_DATA:
|
||||||
|
case IMRS_SIGNAL:
|
||||||
|
{
|
||||||
|
return_status = IMRS_OK;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case IMRS_KO:
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( IMRG_MR_Base.Config.Continue_Forced == IMRD_TRUE)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Closing trash medium...");
|
||||||
|
|
||||||
|
if( ( status = IMR_IOM_Medium_Close( medium_trash_ptr)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't close trash medium (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
|
||||||
|
medium_trash_ptr = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Closing output medium...");
|
||||||
|
|
||||||
|
if( ( status = IMR_IOM_Medium_Close( medium_output_ptr)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't close output medium (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
|
||||||
|
medium_output_ptr = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
IMRD_LM_LOG_TRACE_0( IMRD_LOG_LEVEL_VERBOSE_0, "Closing input medium...");
|
||||||
|
|
||||||
|
if( ( status = IMR_IOM_Medium_Close( medium_input_ptr)) != IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_1( "Can't close input medium (%d) !", status);
|
||||||
|
|
||||||
|
return_status = IMRS_KO;
|
||||||
|
}
|
||||||
|
|
||||||
|
medium_input_ptr = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return( return_status);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
146
src/libmsg_router/src/libmsg_router.h
Normal file
146
src/libmsg_router/src/libmsg_router.h
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: libmsg_router.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _LIBMSG_ROUTER_H_
|
||||||
|
#define _LIBMSG_ROUTER_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include <imr.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Lib Definitions */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_MR_MODULE_ID ( IMRT_Module_Id) 5
|
||||||
|
#define IMRD_MR_MODULE_NAME ( IMRT_Module_Name) "mr"
|
||||||
|
#define IMRD_MR_MODULE_NAME_LONG ( IMRT_Module_Name_Long) "Message Router"
|
||||||
|
#define IMRD_MR_MODULE_VERSION ( IMRT_Module_Version) "@(#) VERSIONIMR: $Label: $ $Date: 2008/11/12 02:25:23 $ $Workfile: libmsg_router.h $"
|
||||||
|
|
||||||
|
#define IMRD_MODULE_PTR &IMRG_MR_Module
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_MR_Base
|
||||||
|
{
|
||||||
|
IMRT_MR_Config Config;
|
||||||
|
} IMRT_MR_Base;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local Definitions */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define IMRD_MR_LOG_ID_HEADER_MSG_INPUT ( IMRT_Log_Id_Header) "Input Message Id:"
|
||||||
|
#define IMRD_MR_LOG_ID_HEADER_MSG_OUTPUT ( IMRT_Log_Id_Header) "Output Message Id:"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBMSG_ROUTER_C_
|
||||||
|
|
||||||
|
IMRT_Status Close_All( IMRT_Buffer *, IMRT_Buffer *, IMRT_Medium *, IMRT_Medium *, IMRT_Medium *);
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local Includes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBMSG_ROUTER_C_
|
||||||
|
|
||||||
|
IMRT_MR_Base IMRG_MR_Base =
|
||||||
|
{
|
||||||
|
{
|
||||||
|
IMRD_FALSE,
|
||||||
|
IMRD_READ_MODE_WAIT
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
IMRT_Module IMRG_MR_Module =
|
||||||
|
{
|
||||||
|
IMRD_MR_MODULE_ID,
|
||||||
|
IMRD_MR_MODULE_NAME,
|
||||||
|
IMRD_MR_MODULE_NAME_LONG,
|
||||||
|
IMRD_MR_MODULE_VERSION,
|
||||||
|
IMRD_MODULE_TYPE_LIBRARY,
|
||||||
|
{
|
||||||
|
IMRD_LIB_STATUS_CLOSED,
|
||||||
|
( IMRT_Lib_Open *) &IMR_MR_Library_Open,
|
||||||
|
( IMRT_Lib_Close *) &IMR_MR_Library_Close
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
extern IMRT_MR_Base IMRG_MR_Base;
|
||||||
|
extern IMRT_Module IMRG_MR_Module;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
355
src/libnode/GNU-FDL.txt
Normal file
355
src/libnode/GNU-FDL.txt
Normal file
@ -0,0 +1,355 @@
|
|||||||
|
GNU Free Documentation License
|
||||||
|
Version 1.1, March 2000
|
||||||
|
|
||||||
|
Copyright (C) 2000 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
|
||||||
|
0. PREAMBLE
|
||||||
|
|
||||||
|
The purpose of this License is to make a manual, textbook, or other
|
||||||
|
written document "free" in the sense of freedom: to assure everyone
|
||||||
|
the effective freedom to copy and redistribute it, with or without
|
||||||
|
modifying it, either commercially or noncommercially. Secondarily,
|
||||||
|
this License preserves for the author and publisher a way to get
|
||||||
|
credit for their work, while not being considered responsible for
|
||||||
|
modifications made by others.
|
||||||
|
|
||||||
|
This License is a kind of "copyleft", which means that derivative
|
||||||
|
works of the document must themselves be free in the same sense. It
|
||||||
|
complements the GNU General Public License, which is a copyleft
|
||||||
|
license designed for free software.
|
||||||
|
|
||||||
|
We have designed this License in order to use it for manuals for free
|
||||||
|
software, because free software needs free documentation: a free
|
||||||
|
program should come with manuals providing the same freedoms that the
|
||||||
|
software does. But this License is not limited to software manuals;
|
||||||
|
it can be used for any textual work, regardless of subject matter or
|
||||||
|
whether it is published as a printed book. We recommend this License
|
||||||
|
principally for works whose purpose is instruction or reference.
|
||||||
|
|
||||||
|
|
||||||
|
1. APPLICABILITY AND DEFINITIONS
|
||||||
|
|
||||||
|
This License applies to any manual or other work that contains a
|
||||||
|
notice placed by the copyright holder saying it can be distributed
|
||||||
|
under the terms of this License. The "Document", below, refers to any
|
||||||
|
such manual or work. Any member of the public is a licensee, and is
|
||||||
|
addressed as "you".
|
||||||
|
|
||||||
|
A "Modified Version" of the Document means any work containing the
|
||||||
|
Document or a portion of it, either copied verbatim, or with
|
||||||
|
modifications and/or translated into another language.
|
||||||
|
|
||||||
|
A "Secondary Section" is a named appendix or a front-matter section of
|
||||||
|
the Document that deals exclusively with the relationship of the
|
||||||
|
publishers or authors of the Document to the Document's overall subject
|
||||||
|
(or to related matters) and contains nothing that could fall directly
|
||||||
|
within that overall subject. (For example, if the Document is in part a
|
||||||
|
textbook of mathematics, a Secondary Section may not explain any
|
||||||
|
mathematics.) The relationship could be a matter of historical
|
||||||
|
connection with the subject or with related matters, or of legal,
|
||||||
|
commercial, philosophical, ethical or political position regarding
|
||||||
|
them.
|
||||||
|
|
||||||
|
The "Invariant Sections" are certain Secondary Sections whose titles
|
||||||
|
are designated, as being those of Invariant Sections, in the notice
|
||||||
|
that says that the Document is released under this License.
|
||||||
|
|
||||||
|
The "Cover Texts" are certain short passages of text that are listed,
|
||||||
|
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||||
|
the Document is released under this License.
|
||||||
|
|
||||||
|
A "Transparent" copy of the Document means a machine-readable copy,
|
||||||
|
represented in a format whose specification is available to the
|
||||||
|
general public, whose contents can be viewed and edited directly and
|
||||||
|
straightforwardly with generic text editors or (for images composed of
|
||||||
|
pixels) generic paint programs or (for drawings) some widely available
|
||||||
|
drawing editor, and that is suitable for input to text formatters or
|
||||||
|
for automatic translation to a variety of formats suitable for input
|
||||||
|
to text formatters. A copy made in an otherwise Transparent file
|
||||||
|
format whose markup has been designed to thwart or discourage
|
||||||
|
subsequent modification by readers is not Transparent. A copy that is
|
||||||
|
not "Transparent" is called "Opaque".
|
||||||
|
|
||||||
|
Examples of suitable formats for Transparent copies include plain
|
||||||
|
ASCII without markup, Texinfo input format, LaTeX input format, SGML
|
||||||
|
or XML using a publicly available DTD, and standard-conforming simple
|
||||||
|
HTML designed for human modification. Opaque formats include
|
||||||
|
PostScript, PDF, proprietary formats that can be read and edited only
|
||||||
|
by proprietary word processors, SGML or XML for which the DTD and/or
|
||||||
|
processing tools are not generally available, and the
|
||||||
|
machine-generated HTML produced by some word processors for output
|
||||||
|
purposes only.
|
||||||
|
|
||||||
|
The "Title Page" means, for a printed book, the title page itself,
|
||||||
|
plus such following pages as are needed to hold, legibly, the material
|
||||||
|
this License requires to appear in the title page. For works in
|
||||||
|
formats which do not have any title page as such, "Title Page" means
|
||||||
|
the text near the most prominent appearance of the work's title,
|
||||||
|
preceding the beginning of the body of the text.
|
||||||
|
|
||||||
|
|
||||||
|
2. VERBATIM COPYING
|
||||||
|
|
||||||
|
You may copy and distribute the Document in any medium, either
|
||||||
|
commercially or noncommercially, provided that this License, the
|
||||||
|
copyright notices, and the license notice saying this License applies
|
||||||
|
to the Document are reproduced in all copies, and that you add no other
|
||||||
|
conditions whatsoever to those of this License. You may not use
|
||||||
|
technical measures to obstruct or control the reading or further
|
||||||
|
copying of the copies you make or distribute. However, you may accept
|
||||||
|
compensation in exchange for copies. If you distribute a large enough
|
||||||
|
number of copies you must also follow the conditions in section 3.
|
||||||
|
|
||||||
|
You may also lend copies, under the same conditions stated above, and
|
||||||
|
you may publicly display copies.
|
||||||
|
|
||||||
|
|
||||||
|
3. COPYING IN QUANTITY
|
||||||
|
|
||||||
|
If you publish printed copies of the Document numbering more than 100,
|
||||||
|
and the Document's license notice requires Cover Texts, you must enclose
|
||||||
|
the copies in covers that carry, clearly and legibly, all these Cover
|
||||||
|
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||||
|
the back cover. Both covers must also clearly and legibly identify
|
||||||
|
you as the publisher of these copies. The front cover must present
|
||||||
|
the full title with all words of the title equally prominent and
|
||||||
|
visible. You may add other material on the covers in addition.
|
||||||
|
Copying with changes limited to the covers, as long as they preserve
|
||||||
|
the title of the Document and satisfy these conditions, can be treated
|
||||||
|
as verbatim copying in other respects.
|
||||||
|
|
||||||
|
If the required texts for either cover are too voluminous to fit
|
||||||
|
legibly, you should put the first ones listed (as many as fit
|
||||||
|
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||||
|
pages.
|
||||||
|
|
||||||
|
If you publish or distribute Opaque copies of the Document numbering
|
||||||
|
more than 100, you must either include a machine-readable Transparent
|
||||||
|
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||||
|
a publicly-accessible computer-network location containing a complete
|
||||||
|
Transparent copy of the Document, free of added material, which the
|
||||||
|
general network-using public has access to download anonymously at no
|
||||||
|
charge using public-standard network protocols. If you use the latter
|
||||||
|
option, you must take reasonably prudent steps, when you begin
|
||||||
|
distribution of Opaque copies in quantity, to ensure that this
|
||||||
|
Transparent copy will remain thus accessible at the stated location
|
||||||
|
until at least one year after the last time you distribute an Opaque
|
||||||
|
copy (directly or through your agents or retailers) of that edition to
|
||||||
|
the public.
|
||||||
|
|
||||||
|
It is requested, but not required, that you contact the authors of the
|
||||||
|
Document well before redistributing any large number of copies, to give
|
||||||
|
them a chance to provide you with an updated version of the Document.
|
||||||
|
|
||||||
|
|
||||||
|
4. MODIFICATIONS
|
||||||
|
|
||||||
|
You may copy and distribute a Modified Version of the Document under
|
||||||
|
the conditions of sections 2 and 3 above, provided that you release
|
||||||
|
the Modified Version under precisely this License, with the Modified
|
||||||
|
Version filling the role of the Document, thus licensing distribution
|
||||||
|
and modification of the Modified Version to whoever possesses a copy
|
||||||
|
of it. In addition, you must do these things in the Modified Version:
|
||||||
|
|
||||||
|
A. Use in the Title Page (and on the covers, if any) a title distinct
|
||||||
|
from that of the Document, and from those of previous versions
|
||||||
|
(which should, if there were any, be listed in the History section
|
||||||
|
of the Document). You may use the same title as a previous version
|
||||||
|
if the original publisher of that version gives permission.
|
||||||
|
B. List on the Title Page, as authors, one or more persons or entities
|
||||||
|
responsible for authorship of the modifications in the Modified
|
||||||
|
Version, together with at least five of the principal authors of the
|
||||||
|
Document (all of its principal authors, if it has less than five).
|
||||||
|
C. State on the Title page the name of the publisher of the
|
||||||
|
Modified Version, as the publisher.
|
||||||
|
D. Preserve all the copyright notices of the Document.
|
||||||
|
E. Add an appropriate copyright notice for your modifications
|
||||||
|
adjacent to the other copyright notices.
|
||||||
|
F. Include, immediately after the copyright notices, a license notice
|
||||||
|
giving the public permission to use the Modified Version under the
|
||||||
|
terms of this License, in the form shown in the Addendum below.
|
||||||
|
G. Preserve in that license notice the full lists of Invariant Sections
|
||||||
|
and required Cover Texts given in the Document's license notice.
|
||||||
|
H. Include an unaltered copy of this License.
|
||||||
|
I. Preserve the section entitled "History", and its title, and add to
|
||||||
|
it an item stating at least the title, year, new authors, and
|
||||||
|
publisher of the Modified Version as given on the Title Page. If
|
||||||
|
there is no section entitled "History" in the Document, create one
|
||||||
|
stating the title, year, authors, and publisher of the Document as
|
||||||
|
given on its Title Page, then add an item describing the Modified
|
||||||
|
Version as stated in the previous sentence.
|
||||||
|
J. Preserve the network location, if any, given in the Document for
|
||||||
|
public access to a Transparent copy of the Document, and likewise
|
||||||
|
the network locations given in the Document for previous versions
|
||||||
|
it was based on. These may be placed in the "History" section.
|
||||||
|
You may omit a network location for a work that was published at
|
||||||
|
least four years before the Document itself, or if the original
|
||||||
|
publisher of the version it refers to gives permission.
|
||||||
|
K. In any section entitled "Acknowledgements" or "Dedications",
|
||||||
|
preserve the section's title, and preserve in the section all the
|
||||||
|
substance and tone of each of the contributor acknowledgements
|
||||||
|
and/or dedications given therein.
|
||||||
|
L. Preserve all the Invariant Sections of the Document,
|
||||||
|
unaltered in their text and in their titles. Section numbers
|
||||||
|
or the equivalent are not considered part of the section titles.
|
||||||
|
M. Delete any section entitled "Endorsements". Such a section
|
||||||
|
may not be included in the Modified Version.
|
||||||
|
N. Do not retitle any existing section as "Endorsements"
|
||||||
|
or to conflict in title with any Invariant Section.
|
||||||
|
|
||||||
|
If the Modified Version includes new front-matter sections or
|
||||||
|
appendices that qualify as Secondary Sections and contain no material
|
||||||
|
copied from the Document, you may at your option designate some or all
|
||||||
|
of these sections as invariant. To do this, add their titles to the
|
||||||
|
list of Invariant Sections in the Modified Version's license notice.
|
||||||
|
These titles must be distinct from any other section titles.
|
||||||
|
|
||||||
|
You may add a section entitled "Endorsements", provided it contains
|
||||||
|
nothing but endorsements of your Modified Version by various
|
||||||
|
parties--for example, statements of peer review or that the text has
|
||||||
|
been approved by an organization as the authoritative definition of a
|
||||||
|
standard.
|
||||||
|
|
||||||
|
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||||
|
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||||
|
of Cover Texts in the Modified Version. Only one passage of
|
||||||
|
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||||
|
through arrangements made by) any one entity. If the Document already
|
||||||
|
includes a cover text for the same cover, previously added by you or
|
||||||
|
by arrangement made by the same entity you are acting on behalf of,
|
||||||
|
you may not add another; but you may replace the old one, on explicit
|
||||||
|
permission from the previous publisher that added the old one.
|
||||||
|
|
||||||
|
The author(s) and publisher(s) of the Document do not by this License
|
||||||
|
give permission to use their names for publicity for or to assert or
|
||||||
|
imply endorsement of any Modified Version.
|
||||||
|
|
||||||
|
|
||||||
|
5. COMBINING DOCUMENTS
|
||||||
|
|
||||||
|
You may combine the Document with other documents released under this
|
||||||
|
License, under the terms defined in section 4 above for modified
|
||||||
|
versions, provided that you include in the combination all of the
|
||||||
|
Invariant Sections of all of the original documents, unmodified, and
|
||||||
|
list them all as Invariant Sections of your combined work in its
|
||||||
|
license notice.
|
||||||
|
|
||||||
|
The combined work need only contain one copy of this License, and
|
||||||
|
multiple identical Invariant Sections may be replaced with a single
|
||||||
|
copy. If there are multiple Invariant Sections with the same name but
|
||||||
|
different contents, make the title of each such section unique by
|
||||||
|
adding at the end of it, in parentheses, the name of the original
|
||||||
|
author or publisher of that section if known, or else a unique number.
|
||||||
|
Make the same adjustment to the section titles in the list of
|
||||||
|
Invariant Sections in the license notice of the combined work.
|
||||||
|
|
||||||
|
In the combination, you must combine any sections entitled "History"
|
||||||
|
in the various original documents, forming one section entitled
|
||||||
|
"History"; likewise combine any sections entitled "Acknowledgements",
|
||||||
|
and any sections entitled "Dedications". You must delete all sections
|
||||||
|
entitled "Endorsements."
|
||||||
|
|
||||||
|
|
||||||
|
6. COLLECTIONS OF DOCUMENTS
|
||||||
|
|
||||||
|
You may make a collection consisting of the Document and other documents
|
||||||
|
released under this License, and replace the individual copies of this
|
||||||
|
License in the various documents with a single copy that is included in
|
||||||
|
the collection, provided that you follow the rules of this License for
|
||||||
|
verbatim copying of each of the documents in all other respects.
|
||||||
|
|
||||||
|
You may extract a single document from such a collection, and distribute
|
||||||
|
it individually under this License, provided you insert a copy of this
|
||||||
|
License into the extracted document, and follow this License in all
|
||||||
|
other respects regarding verbatim copying of that document.
|
||||||
|
|
||||||
|
|
||||||
|
7. AGGREGATION WITH INDEPENDENT WORKS
|
||||||
|
|
||||||
|
A compilation of the Document or its derivatives with other separate
|
||||||
|
and independent documents or works, in or on a volume of a storage or
|
||||||
|
distribution medium, does not as a whole count as a Modified Version
|
||||||
|
of the Document, provided no compilation copyright is claimed for the
|
||||||
|
compilation. Such a compilation is called an "aggregate", and this
|
||||||
|
License does not apply to the other self-contained works thus compiled
|
||||||
|
with the Document, on account of their being thus compiled, if they
|
||||||
|
are not themselves derivative works of the Document.
|
||||||
|
|
||||||
|
If the Cover Text requirement of section 3 is applicable to these
|
||||||
|
copies of the Document, then if the Document is less than one quarter
|
||||||
|
of the entire aggregate, the Document's Cover Texts may be placed on
|
||||||
|
covers that surround only the Document within the aggregate.
|
||||||
|
Otherwise they must appear on covers around the whole aggregate.
|
||||||
|
|
||||||
|
|
||||||
|
8. TRANSLATION
|
||||||
|
|
||||||
|
Translation is considered a kind of modification, so you may
|
||||||
|
distribute translations of the Document under the terms of section 4.
|
||||||
|
Replacing Invariant Sections with translations requires special
|
||||||
|
permission from their copyright holders, but you may include
|
||||||
|
translations of some or all Invariant Sections in addition to the
|
||||||
|
original versions of these Invariant Sections. You may include a
|
||||||
|
translation of this License provided that you also include the
|
||||||
|
original English version of this License. In case of a disagreement
|
||||||
|
between the translation and the original English version of this
|
||||||
|
License, the original English version will prevail.
|
||||||
|
|
||||||
|
|
||||||
|
9. TERMINATION
|
||||||
|
|
||||||
|
You may not copy, modify, sublicense, or distribute the Document except
|
||||||
|
as expressly provided for under this License. Any other attempt to
|
||||||
|
copy, modify, sublicense or distribute the Document is void, and will
|
||||||
|
automatically terminate your rights under this License. However,
|
||||||
|
parties who have received copies, or rights, from you under this
|
||||||
|
License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
|
||||||
|
10. FUTURE REVISIONS OF THIS LICENSE
|
||||||
|
|
||||||
|
The Free Software Foundation may publish new, revised versions
|
||||||
|
of the GNU Free Documentation 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. See
|
||||||
|
http://www.gnu.org/copyleft/.
|
||||||
|
|
||||||
|
Each version of the License is given a distinguishing version number.
|
||||||
|
If the Document specifies that a particular numbered version of this
|
||||||
|
License "or any later version" applies to it, you have the option of
|
||||||
|
following the terms and conditions either of that specified version or
|
||||||
|
of any later version that has been published (not as a draft) by the
|
||||||
|
Free Software Foundation. If the Document does not specify a version
|
||||||
|
number of this License, you may choose any version ever published (not
|
||||||
|
as a draft) by the Free Software Foundation.
|
||||||
|
|
||||||
|
|
||||||
|
ADDENDUM: How to use this License for your documents
|
||||||
|
|
||||||
|
To use this License in a document you have written, include a copy of
|
||||||
|
the License in the document and put the following copyright and
|
||||||
|
license notices just after the title page:
|
||||||
|
|
||||||
|
Copyright (c) YEAR YOUR NAME.
|
||||||
|
Permission is granted to copy, distribute and/or modify this document
|
||||||
|
under the terms of the GNU Free Documentation License, Version 1.1
|
||||||
|
or any later version published by the Free Software Foundation;
|
||||||
|
with the Invariant Sections being LIST THEIR TITLES, with the
|
||||||
|
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
|
||||||
|
A copy of the license is included in the section entitled "GNU
|
||||||
|
Free Documentation License".
|
||||||
|
|
||||||
|
If you have no Invariant Sections, write "with no Invariant Sections"
|
||||||
|
instead of saying which ones are invariant. If you have no
|
||||||
|
Front-Cover Texts, write "no Front-Cover Texts" instead of
|
||||||
|
"Front-Cover Texts being LIST"; likewise for Back-Cover Texts.
|
||||||
|
|
||||||
|
If your document contains nontrivial examples of program code, we
|
||||||
|
recommend releasing these examples in parallel under your choice of
|
||||||
|
free software license, such as the GNU General Public License,
|
||||||
|
to permit their use in free software.
|
340
src/libnode/GNU-GPL.txt
Normal file
340
src/libnode/GNU-GPL.txt
Normal file
@ -0,0 +1,340 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Library General Public License instead.) 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
|
||||||
|
this service 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 make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. 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.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
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
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the 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 a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE 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.
|
||||||
|
|
||||||
|
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
|
||||||
|
convey 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 2 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, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision 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, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This 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 Library General
|
||||||
|
Public License instead of this License.
|
504
src/libnode/GNU-LGPL.txt
Normal file
504
src/libnode/GNU-LGPL.txt
Normal file
@ -0,0 +1,504 @@
|
|||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
Version 2.1, February 1999
|
||||||
|
|
||||||
|
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||||
|
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
[This is the first released version of the Lesser GPL. It also counts
|
||||||
|
as the successor of the GNU Library Public License, version 2, hence
|
||||||
|
the version number 2.1.]
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
Licenses are intended to guarantee your freedom to share and change
|
||||||
|
free software--to make sure the software is free for all its users.
|
||||||
|
|
||||||
|
This license, the Lesser General Public License, applies to some
|
||||||
|
specially designated software packages--typically libraries--of the
|
||||||
|
Free Software Foundation and other authors who decide to use it. You
|
||||||
|
can use it too, but we suggest you first think carefully about whether
|
||||||
|
this license or the ordinary General Public License is the better
|
||||||
|
strategy to use in any particular case, based on the explanations below.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom of use,
|
||||||
|
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 this service if you wish); that you receive source code or can get
|
||||||
|
it if you want it; that you can change the software and use pieces of
|
||||||
|
it in new free programs; and that you are informed that you can do
|
||||||
|
these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
distributors to deny you these rights or to ask you to surrender these
|
||||||
|
rights. These restrictions translate to certain responsibilities for
|
||||||
|
you if you distribute copies of the library or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of the library, whether gratis
|
||||||
|
or for a fee, you must give the recipients all the rights that we gave
|
||||||
|
you. You must make sure that they, too, receive or can get the source
|
||||||
|
code. If you link other code with the library, you must provide
|
||||||
|
complete object files to the recipients, so that they can relink them
|
||||||
|
with the library after making changes to the library and recompiling
|
||||||
|
it. And you must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
We protect your rights with a two-step method: (1) we copyright the
|
||||||
|
library, and (2) we offer you this license, which gives you legal
|
||||||
|
permission to copy, distribute and/or modify the library.
|
||||||
|
|
||||||
|
To protect each distributor, we want to make it very clear that
|
||||||
|
there is no warranty for the free library. Also, if the library is
|
||||||
|
modified by someone else and passed on, the recipients should know
|
||||||
|
that what they have is not the original version, so that the original
|
||||||
|
author's reputation will not be affected by problems that might be
|
||||||
|
introduced by others.
|
||||||
|
|
||||||
|
Finally, software patents pose a constant threat to the existence of
|
||||||
|
any free program. We wish to make sure that a company cannot
|
||||||
|
effectively restrict the users of a free program by obtaining a
|
||||||
|
restrictive license from a patent holder. Therefore, we insist that
|
||||||
|
any patent license obtained for a version of the library must be
|
||||||
|
consistent with the full freedom of use specified in this license.
|
||||||
|
|
||||||
|
Most GNU software, including some libraries, is covered by the
|
||||||
|
ordinary GNU General Public License. This license, the GNU Lesser
|
||||||
|
General Public License, applies to certain designated libraries, and
|
||||||
|
is quite different from the ordinary General Public License. We use
|
||||||
|
this license for certain libraries in order to permit linking those
|
||||||
|
libraries into non-free programs.
|
||||||
|
|
||||||
|
When a program is linked with a library, whether statically or using
|
||||||
|
a shared library, the combination of the two is legally speaking a
|
||||||
|
combined work, a derivative of the original library. The ordinary
|
||||||
|
General Public License therefore permits such linking only if the
|
||||||
|
entire combination fits its criteria of freedom. The Lesser General
|
||||||
|
Public License permits more lax criteria for linking other code with
|
||||||
|
the library.
|
||||||
|
|
||||||
|
We call this license the "Lesser" General Public License because it
|
||||||
|
does Less to protect the user's freedom than the ordinary General
|
||||||
|
Public License. It also provides other free software developers Less
|
||||||
|
of an advantage over competing non-free programs. These disadvantages
|
||||||
|
are the reason we use the ordinary General Public License for many
|
||||||
|
libraries. However, the Lesser license provides advantages in certain
|
||||||
|
special circumstances.
|
||||||
|
|
||||||
|
For example, on rare occasions, there may be a special need to
|
||||||
|
encourage the widest possible use of a certain library, so that it becomes
|
||||||
|
a de-facto standard. To achieve this, non-free programs must be
|
||||||
|
allowed to use the library. A more frequent case is that a free
|
||||||
|
library does the same job as widely used non-free libraries. In this
|
||||||
|
case, there is little to gain by limiting the free library to free
|
||||||
|
software only, so we use the Lesser General Public License.
|
||||||
|
|
||||||
|
In other cases, permission to use a particular library in non-free
|
||||||
|
programs enables a greater number of people to use a large body of
|
||||||
|
free software. For example, permission to use the GNU C Library in
|
||||||
|
non-free programs enables many more people to use the whole GNU
|
||||||
|
operating system, as well as its variant, the GNU/Linux operating
|
||||||
|
system.
|
||||||
|
|
||||||
|
Although the Lesser General Public License is Less protective of the
|
||||||
|
users' freedom, it does ensure that the user of a program that is
|
||||||
|
linked with the Library has the freedom and the wherewithal to run
|
||||||
|
that program using a modified version of the Library.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow. Pay close attention to the difference between a
|
||||||
|
"work based on the library" and a "work that uses the library". The
|
||||||
|
former contains code derived from the library, whereas the latter must
|
||||||
|
be combined with the library in order to run.
|
||||||
|
|
||||||
|
GNU LESSER GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License Agreement applies to any software library or other
|
||||||
|
program which contains a notice placed by the copyright holder or
|
||||||
|
other authorized party saying it may be distributed under the terms of
|
||||||
|
this Lesser General Public License (also called "this License").
|
||||||
|
Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
A "library" means a collection of software functions and/or data
|
||||||
|
prepared so as to be conveniently linked with application programs
|
||||||
|
(which use some of those functions and data) to form executables.
|
||||||
|
|
||||||
|
The "Library", below, refers to any such software library or work
|
||||||
|
which has been distributed under these terms. A "work based on the
|
||||||
|
Library" means either the Library or any derivative work under
|
||||||
|
copyright law: that is to say, a work containing the Library or a
|
||||||
|
portion of it, either verbatim or with modifications and/or translated
|
||||||
|
straightforwardly into another language. (Hereinafter, translation is
|
||||||
|
included without limitation in the term "modification".)
|
||||||
|
|
||||||
|
"Source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For a library, complete source code means
|
||||||
|
all the source code for all modules it contains, plus any associated
|
||||||
|
interface definition files, plus the scripts used to control compilation
|
||||||
|
and installation of the library.
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running a program using the Library is not restricted, and output from
|
||||||
|
such a program is covered only if its contents constitute a work based
|
||||||
|
on the Library (independent of the use of the Library in a tool for
|
||||||
|
writing it). Whether that is true depends on what the Library does
|
||||||
|
and what the program that uses the Library does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Library's
|
||||||
|
complete source code as you receive it, in any medium, provided that
|
||||||
|
you conspicuously and appropriately publish on each copy an
|
||||||
|
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||||
|
all the notices that refer to this License and to the absence of any
|
||||||
|
warranty; and distribute a copy of this License along with the
|
||||||
|
Library.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy,
|
||||||
|
and you may at your option offer warranty protection in exchange for a
|
||||||
|
fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Library or any portion
|
||||||
|
of it, thus forming a work based on the Library, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The modified work must itself be a software library.
|
||||||
|
|
||||||
|
b) You must cause the files modified to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
c) You must cause the whole of the work to be licensed at no
|
||||||
|
charge to all third parties under the terms of this License.
|
||||||
|
|
||||||
|
d) If a facility in the modified Library refers to a function or a
|
||||||
|
table of data to be supplied by an application program that uses
|
||||||
|
the facility, other than as an argument passed when the facility
|
||||||
|
is invoked, then you must make a good faith effort to ensure that,
|
||||||
|
in the event an application does not supply such function or
|
||||||
|
table, the facility still operates, and performs whatever part of
|
||||||
|
its purpose remains meaningful.
|
||||||
|
|
||||||
|
(For example, a function in a library to compute square roots has
|
||||||
|
a purpose that is entirely well-defined independent of the
|
||||||
|
application. Therefore, Subsection 2d requires that any
|
||||||
|
application-supplied function or table used by this function must
|
||||||
|
be optional: if the application does not supply it, the square
|
||||||
|
root function must still compute square roots.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Library,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Library, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote
|
||||||
|
it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Library.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Library
|
||||||
|
with the Library (or with a work based on the Library) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||||
|
License instead of this License to a given copy of the Library. To do
|
||||||
|
this, you must alter all the notices that refer to this License, so
|
||||||
|
that they refer to the ordinary GNU General Public License, version 2,
|
||||||
|
instead of to this License. (If a newer version than version 2 of the
|
||||||
|
ordinary GNU General Public License has appeared, then you can specify
|
||||||
|
that version instead if you wish.) Do not make any other change in
|
||||||
|
these notices.
|
||||||
|
|
||||||
|
Once this change is made in a given copy, it is irreversible for
|
||||||
|
that copy, so the ordinary GNU General Public License applies to all
|
||||||
|
subsequent copies and derivative works made from that copy.
|
||||||
|
|
||||||
|
This option is useful when you wish to copy part of the code of
|
||||||
|
the Library into a program that is not a library.
|
||||||
|
|
||||||
|
4. You may copy and distribute the Library (or a portion or
|
||||||
|
derivative of it, under Section 2) in object code or executable form
|
||||||
|
under the terms of Sections 1 and 2 above provided that you accompany
|
||||||
|
it with the complete corresponding machine-readable source code, which
|
||||||
|
must be distributed under the terms of Sections 1 and 2 above on a
|
||||||
|
medium customarily used for software interchange.
|
||||||
|
|
||||||
|
If distribution of object code is made by offering access to copy
|
||||||
|
from a designated place, then offering equivalent access to copy the
|
||||||
|
source code from the same place satisfies the requirement to
|
||||||
|
distribute the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
5. A program that contains no derivative of any portion of the
|
||||||
|
Library, but is designed to work with the Library by being compiled or
|
||||||
|
linked with it, is called a "work that uses the Library". Such a
|
||||||
|
work, in isolation, is not a derivative work of the Library, and
|
||||||
|
therefore falls outside the scope of this License.
|
||||||
|
|
||||||
|
However, linking a "work that uses the Library" with the Library
|
||||||
|
creates an executable that is a derivative of the Library (because it
|
||||||
|
contains portions of the Library), rather than a "work that uses the
|
||||||
|
library". The executable is therefore covered by this License.
|
||||||
|
Section 6 states terms for distribution of such executables.
|
||||||
|
|
||||||
|
When a "work that uses the Library" uses material from a header file
|
||||||
|
that is part of the Library, the object code for the work may be a
|
||||||
|
derivative work of the Library even though the source code is not.
|
||||||
|
Whether this is true is especially significant if the work can be
|
||||||
|
linked without the Library, or if the work is itself a library. The
|
||||||
|
threshold for this to be true is not precisely defined by law.
|
||||||
|
|
||||||
|
If such an object file uses only numerical parameters, data
|
||||||
|
structure layouts and accessors, and small macros and small inline
|
||||||
|
functions (ten lines or less in length), then the use of the object
|
||||||
|
file is unrestricted, regardless of whether it is legally a derivative
|
||||||
|
work. (Executables containing this object code plus portions of the
|
||||||
|
Library will still fall under Section 6.)
|
||||||
|
|
||||||
|
Otherwise, if the work is a derivative of the Library, you may
|
||||||
|
distribute the object code for the work under the terms of Section 6.
|
||||||
|
Any executables containing that work also fall under Section 6,
|
||||||
|
whether or not they are linked directly with the Library itself.
|
||||||
|
|
||||||
|
6. As an exception to the Sections above, you may also combine or
|
||||||
|
link a "work that uses the Library" with the Library to produce a
|
||||||
|
work containing portions of the Library, and distribute that work
|
||||||
|
under terms of your choice, provided that the terms permit
|
||||||
|
modification of the work for the customer's own use and reverse
|
||||||
|
engineering for debugging such modifications.
|
||||||
|
|
||||||
|
You must give prominent notice with each copy of the work that the
|
||||||
|
Library is used in it and that the Library and its use are covered by
|
||||||
|
this License. You must supply a copy of this License. If the work
|
||||||
|
during execution displays copyright notices, you must include the
|
||||||
|
copyright notice for the Library among them, as well as a reference
|
||||||
|
directing the user to the copy of this License. Also, you must do one
|
||||||
|
of these things:
|
||||||
|
|
||||||
|
a) Accompany the work with the complete corresponding
|
||||||
|
machine-readable source code for the Library including whatever
|
||||||
|
changes were used in the work (which must be distributed under
|
||||||
|
Sections 1 and 2 above); and, if the work is an executable linked
|
||||||
|
with the Library, with the complete machine-readable "work that
|
||||||
|
uses the Library", as object code and/or source code, so that the
|
||||||
|
user can modify the Library and then relink to produce a modified
|
||||||
|
executable containing the modified Library. (It is understood
|
||||||
|
that the user who changes the contents of definitions files in the
|
||||||
|
Library will not necessarily be able to recompile the application
|
||||||
|
to use the modified definitions.)
|
||||||
|
|
||||||
|
b) Use a suitable shared library mechanism for linking with the
|
||||||
|
Library. A suitable mechanism is one that (1) uses at run time a
|
||||||
|
copy of the library already present on the user's computer system,
|
||||||
|
rather than copying library functions into the executable, and (2)
|
||||||
|
will operate properly with a modified version of the library, if
|
||||||
|
the user installs one, as long as the modified version is
|
||||||
|
interface-compatible with the version that the work was made with.
|
||||||
|
|
||||||
|
c) Accompany the work with a written offer, valid for at
|
||||||
|
least three years, to give the same user the materials
|
||||||
|
specified in Subsection 6a, above, for a charge no more
|
||||||
|
than the cost of performing this distribution.
|
||||||
|
|
||||||
|
d) If distribution of the work is made by offering access to copy
|
||||||
|
from a designated place, offer equivalent access to copy the above
|
||||||
|
specified materials from the same place.
|
||||||
|
|
||||||
|
e) Verify that the user has already received a copy of these
|
||||||
|
materials or that you have already sent this user a copy.
|
||||||
|
|
||||||
|
For an executable, the required form of the "work that uses the
|
||||||
|
Library" must include any data and utility programs needed for
|
||||||
|
reproducing the executable from it. However, as a special exception,
|
||||||
|
the materials to be distributed need not include anything that is
|
||||||
|
normally distributed (in either source or binary form) with the major
|
||||||
|
components (compiler, kernel, and so on) of the operating system on
|
||||||
|
which the executable runs, unless that component itself accompanies
|
||||||
|
the executable.
|
||||||
|
|
||||||
|
It may happen that this requirement contradicts the license
|
||||||
|
restrictions of other proprietary libraries that do not normally
|
||||||
|
accompany the operating system. Such a contradiction means you cannot
|
||||||
|
use both them and the Library together in an executable that you
|
||||||
|
distribute.
|
||||||
|
|
||||||
|
7. You may place library facilities that are a work based on the
|
||||||
|
Library side-by-side in a single library together with other library
|
||||||
|
facilities not covered by this License, and distribute such a combined
|
||||||
|
library, provided that the separate distribution of the work based on
|
||||||
|
the Library and of the other library facilities is otherwise
|
||||||
|
permitted, and provided that you do these two things:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work
|
||||||
|
based on the Library, uncombined with any other library
|
||||||
|
facilities. This must be distributed under the terms of the
|
||||||
|
Sections above.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library of the fact
|
||||||
|
that part of it is a work based on the Library, and explaining
|
||||||
|
where to find the accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
8. You may not copy, modify, sublicense, link with, or distribute
|
||||||
|
the Library except as expressly provided under this License. Any
|
||||||
|
attempt otherwise to copy, modify, sublicense, link with, or
|
||||||
|
distribute the Library is void, and will automatically terminate your
|
||||||
|
rights under this License. However, parties who have received copies,
|
||||||
|
or rights, from you under this License will not have their licenses
|
||||||
|
terminated so long as such parties remain in full compliance.
|
||||||
|
|
||||||
|
9. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Library or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Library (or any work based on the
|
||||||
|
Library), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Library or works based on it.
|
||||||
|
|
||||||
|
10. Each time you redistribute the Library (or any work based on the
|
||||||
|
Library), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute, link with or modify the Library
|
||||||
|
subject to these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties with
|
||||||
|
this License.
|
||||||
|
|
||||||
|
11. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
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
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Library at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Library by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Library.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under any
|
||||||
|
particular circumstance, the balance of the section is intended to apply,
|
||||||
|
and the section as a whole is intended to apply in other circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
12. If the distribution and/or use of the Library is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Library under this License may add
|
||||||
|
an explicit geographical distribution limitation excluding those countries,
|
||||||
|
so that distribution is permitted only in or among countries not thus
|
||||||
|
excluded. In such case, this License incorporates the limitation as if
|
||||||
|
written in the body of this License.
|
||||||
|
|
||||||
|
13. The Free Software Foundation may publish revised and/or new
|
||||||
|
versions of the Lesser 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 Library
|
||||||
|
specifies a version number of this License which applies to it and
|
||||||
|
"any later version", you have the option of following the terms and
|
||||||
|
conditions either of that version or of any later version published by
|
||||||
|
the Free Software Foundation. If the Library does not specify a
|
||||||
|
license version number, you may choose any version ever published by
|
||||||
|
the Free Software Foundation.
|
||||||
|
|
||||||
|
14. If you wish to incorporate parts of the Library into other free
|
||||||
|
programs whose distribution conditions are incompatible with these,
|
||||||
|
write to the author to ask for permission. For software which is
|
||||||
|
copyrighted by the Free Software Foundation, write to the Free
|
||||||
|
Software Foundation; we sometimes make exceptions for this. Our
|
||||||
|
decision will be guided by the two goals of preserving the free status
|
||||||
|
of all derivatives of our free software and of promoting the sharing
|
||||||
|
and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||||
|
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||||
|
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||||
|
OTHER PARTIES PROVIDE THE LIBRARY "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
|
||||||
|
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||||
|
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||||
|
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||||
|
AND/OR REDISTRIBUTE THE LIBRARY 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
|
||||||
|
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||||
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Libraries
|
||||||
|
|
||||||
|
If you develop a new library, and you want it to be of the greatest
|
||||||
|
possible use to the public, we recommend making it free software that
|
||||||
|
everyone can redistribute and change. You can do so by permitting
|
||||||
|
redistribution under these terms (or, alternatively, under the terms of the
|
||||||
|
ordinary General Public License).
|
||||||
|
|
||||||
|
To apply these terms, attach the following notices to the library. It is
|
||||||
|
safest to attach them to the start of each source file to most effectively
|
||||||
|
convey 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 library's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Lesser General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2.1 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this library; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||||
|
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1990
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
That's all there is to it!
|
||||||
|
|
||||||
|
|
44
src/libnode/ReadMe.txt
Normal file
44
src/libnode/ReadMe.txt
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
# %RCSfile: ReadMe.txt,v %
|
||||||
|
# %Revision: 2.8 %
|
||||||
|
# %Name: libnode-2_1_0-1 %
|
||||||
|
# %Date: 2005/01/24 01:19:50 %
|
||||||
|
# %Author: agibert %
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Welcome to LibNode 2.1.x !
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
This release of LibNode supports the following OS:
|
||||||
|
- Linux 2.2.x, 2.4.x and 2.6.x (tested on RedHat & Mandrake),
|
||||||
|
- Solaris 2.6,
|
||||||
|
- Windows NT4, 2000 and XP.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
The support of LibVer is now optional (To enable it, use: make _LIBVER_SUPPORT=1 all).
|
||||||
|
|
||||||
|
LibNode support LibShMem 2.0.0 and LibDataStr 2.0.0 !
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Warning: Associated documentation (including the comments !) is outdated...
|
||||||
|
Please read demo and ndbench code.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Libnode is licensed under the LGPL/GPL GNU Licenses.
|
||||||
|
For more information, please read the corresponding source file headers.
|
||||||
|
The license details can be found in the GNU-GPL.txt, GNU-LGPL.txt and GNU-FDL.txt files.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Enjoy it!
|
||||||
|
|
||||||
|
Your LibNode Team.
|
||||||
|
|
||||||
|
arnaud@rx3.net
|
||||||
|
http://www.rx3.org/dvp/libnode
|
220
src/libnode/ReleaseNotes.txt
Normal file
220
src/libnode/ReleaseNotes.txt
Normal file
@ -0,0 +1,220 @@
|
|||||||
|
# %RCSfile: ReleaseNotes.txt,v %
|
||||||
|
# %Revision: 2.20 %
|
||||||
|
# %Name: libnode-2_1_0-1 %
|
||||||
|
# %Date: 2005/01/24 00:50:55 %
|
||||||
|
# %Author: agibert %
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 2.1.0-1 - A. Gibert - 24/01/05
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
All: This new LibNode branch (2.1.x) should support the forthcoming new LibShMem branch (2.0.x),
|
||||||
|
LibNode: Add symbol lookup support for manager, allocator and desallocator functions call,
|
||||||
|
New Allocator and desallocator API interace,
|
||||||
|
Code cleanup,
|
||||||
|
NDBench: DS_Open now support an arg in order to use or not symbol lookup,
|
||||||
|
Add test-*-s.ndb batch files witch use symbol lookup.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 2.0.7-1 - A. Gibert - 20/01/05
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
All: Add to Makefile.var auto version label detection from CVS Tag.
|
||||||
|
This should be the final release of the 2.0 branch,
|
||||||
|
This new release is developped for the MICOT/Target project (Banque de France - Paris).
|
||||||
|
LibNode: Minor bug fixes in ND_*_Info_Print() functions and ND_Library_StdErr_Set alias defines.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 2.0.6-1 - A. Gibert - 24/08/04
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
All: Generate *-c executables with checking mode enabled (ND_MODE=1),
|
||||||
|
Code clean up and more cleanly indented,
|
||||||
|
This new release is developped for the MICOT/Target project (Banque de France - Paris),
|
||||||
|
LibNode: Add OpenStruct tracing support (Enabled by ND_MODE=1 and Debug=1),
|
||||||
|
Re-implement for Unix and Windows target, full address checking in ND_Address_Check(),
|
||||||
|
NDDemo0: Add LibNode 2.0.6 support: Add ND_Library_Open/Close() calls,
|
||||||
|
NDBench: Add Lib_Open, Lib_Close, Index_Value_Break and Index_Node_Break command,
|
||||||
|
Improve random number generation,
|
||||||
|
Add test-10.ndb and test-errror.ndb batch files.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 2.0.5-1 - A. Gibert / M. Regimbeau - 28/07/03
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
All: Add a new Makefile system (Makefile.rule and Makefile.var),
|
||||||
|
Add 'make distrib' support,
|
||||||
|
Add libnode.spec file,
|
||||||
|
Move node.h from lib directory to include directory.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 2.0.4-1 - A. Gibert - 29/07/02
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
All: This release of libnode pass with sucess valgrind test on linux.
|
||||||
|
LibNode: Add and use ND_Index_Clear() private API,
|
||||||
|
NbBench: Add fclose() call at the end of batch_run.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 2.0.3-1 - A. Gibert - 09/04/02
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
All: Fix Microsoft Visual Project to generate Debug and Release config correctly,
|
||||||
|
LibNode: Change index type numeric print value from decimal to hexa in ND_Index_Info_Print() API,
|
||||||
|
LibNode: Add new cases in ND_Index_Convert() handling (List->List:FIFO and List->List:LIFO),
|
||||||
|
LibNode: Generate in Debug mode libnoded.lib, libnoded.dll, libnoded_a.lib,
|
||||||
|
LibNode: Generate in Release mode libnode.lib, libnode.dll, libnode_a.lib,
|
||||||
|
Demo0: Generate in Debug mode demo0d.exe and in Release mode demo0d.exe,
|
||||||
|
NbBench: Generate in Debug mode ndbenchd.exe and in Release mode ndbenchd.exe.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 2.0.2-2 - A. Gibert - 01/03/02
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
All: Add GNU-GPL.txt, GNU-LGPL.txt and GNU-FDL.txt license files,
|
||||||
|
All: Add license stuff in ReandMe.
|
||||||
|
LibNode: Add LGPL header in libnode.c, libnode.h and node.h,
|
||||||
|
LibNode: Replace GPL by LGPL in libnode.rc,
|
||||||
|
Demo0: Add GPL header in demo0.c,
|
||||||
|
NbBench: Add GPL header in ndbench.c.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 2.0.2-1 - A. Gibert - 27/02/02
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
All: Makefiles now generate static and dynamic objects,
|
||||||
|
All: Add no libver support in Makefiles,
|
||||||
|
LibNode: VisualStudio Project now generate Windows DLL and use libnode.rc resource file,
|
||||||
|
LibNode: Rename Index_Open_Nb into Index_Open_Count,
|
||||||
|
LibNode: Fix bugs in ND_Node_Root_Alloc() on Index_Open_Count handling,
|
||||||
|
LibNode: Minor fix into ND_DataStruct_Check_I() and ND_Index_Check_I() functions,
|
||||||
|
NbBench: Implement Index_Close and Index_Info_Print functions.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 2.0.1-1 - A. Gibert - 28/11/01
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
LibNode: Fix the error level of TIMAS_KO: it's now an error status.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 2.0.0-1 - A. Gibert - 26/11/01
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
All: Merge the main CVS trunc with the win32 branche (2.0.0-alpha5),
|
||||||
|
Switch file release to 2.0.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 2.0.0-alpha5 - A. Gibert - 25/10/01
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
LibNode: Add Open/Close Index support,
|
||||||
|
LibNode: Fix return code next to empty struct manipulations,
|
||||||
|
NdBench: Add full multi index support.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 2.0.0-alpha4 - A. Gibert - 28/09/01
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
All: Add optional libver support,
|
||||||
|
LibNode: Fix missing recursive offset args,
|
||||||
|
LibNode: Start to fix some return code of empty struct manipulations,
|
||||||
|
NdBench: Fix local stack pointer big bug.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 2.0.0-alpha3 - A. Gibert - 18/9/01
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
New manager args interface (again !),
|
||||||
|
ndbench support batch mode.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 2.0.0-alpha2 - A. Gibert - 08/09/01
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Re-enable libver support for unix,
|
||||||
|
Bug fixes,
|
||||||
|
Code cleanup.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 2.0.0-alpha1 - A. Gibert - 07/09/01
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Add Full win32 support,
|
||||||
|
Remove libver support,
|
||||||
|
Multi index support,
|
||||||
|
New manager args format,
|
||||||
|
Major Code cleanup et standardisation.
|
||||||
|
This new version (2.0.x) is developped for the TIMA project (Misys IBS - France).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 1.0.0 - S. Mas / A. Gibert - 18/07/00
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Unix (Linux and Solaris) version only, for BDM project (Société Générale - Paris)
|
||||||
|
Major code rewrite.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 0.2.2 - A. Gibert - 01/06/93
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Embeded version on OS/2 2.1 (Companie Générale des Eaux - Paris)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 0.2.1 - A. Gibert - 01/04/92
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Amiga and PC support (Bareau de Draguignan - Ste Maxime).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 0.2.0 - A. Gibert - 01/03/91
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
C version aided by p2c tools on Pyramid (Swansee University - Wales).
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
LibNode V 0.1.0 - A. Gibert - 01/12/90
|
||||||
|
------------------------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Inital version in Pascal on Pyramid (Swansee University - Wales).
|
14
src/libnode/ToDo.txt
Normal file
14
src/libnode/ToDo.txt
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
# %RCSfile: ToDo.txt,v %
|
||||||
|
# %Revision: 2.5 %
|
||||||
|
# %Name: libnode-2_1_0-1 %
|
||||||
|
# %Date: 2005/01/24 01:19:50 %
|
||||||
|
# %Author: agibert %
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- Check LibShMem/LibDataStr support (via symbol lookup support),
|
||||||
|
- Add Cache Value option,
|
||||||
|
- New English documentation (man/tex),
|
||||||
|
- Improve API consitency.
|
686
src/libnode/demo/nddemo0.c
Normal file
686
src/libnode/demo/nddemo0.c
Normal file
@ -0,0 +1,686 @@
|
|||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* %RCSfile: nddemo0.c,v % */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* %Revision: 2.8 % */
|
||||||
|
/* %Name: libnode-2_1_0-1 % */
|
||||||
|
/* %Date: 2004/08/23 22:48:37 % */
|
||||||
|
/* %Author: agibert % */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of LibNode */
|
||||||
|
/* */
|
||||||
|
/* LibNode is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU General Public Licence as published by */
|
||||||
|
/* the Free Software Foundation; either version 2 of the License, or */
|
||||||
|
/* (at your option) any later version. */
|
||||||
|
/* */
|
||||||
|
/* LibNode is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU Lesser General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU General Public License */
|
||||||
|
/* along with LibNode; if not, write to the Free Software */
|
||||||
|
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#include <node.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define DEMO_FILE_NAME "nddemo0.dat"
|
||||||
|
#define STRING_LEN ( short) 1024
|
||||||
|
#define STRING_SIZE ( short) ( STRING_LEN + 1)
|
||||||
|
#define VAL_LEN ( short) 64
|
||||||
|
#define VAL_SIZE ( short) ( VAL_LEN + 1)
|
||||||
|
#define INDEX_NB ( short) 4
|
||||||
|
|
||||||
|
#define NDD_CMD_INDEX0_PRINT ( NDT_Command) 64
|
||||||
|
#define NDD_CMD_INDEX1_PRINT ( NDT_Command) 65
|
||||||
|
#define NDD_CMD_INDEX2_PRINT ( NDT_Command) 66
|
||||||
|
#define NDD_CMD_INDEX3_PRINT ( NDT_Command) 67
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct Demo_Value
|
||||||
|
{
|
||||||
|
char Val0[ VAL_SIZE];
|
||||||
|
char Val1[ VAL_SIZE];
|
||||||
|
char Val2[ VAL_SIZE];
|
||||||
|
char Val3[ VAL_SIZE];
|
||||||
|
} Demo_Value;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
NDT_Status Demo_DS_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
void DataStruct_Load( NDT_Root *, FILE *);
|
||||||
|
void DataStruct_Load( NDT_Root *, FILE *);
|
||||||
|
void Demo( char *, short);
|
||||||
|
int main( int, char **);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
NDT_Status Demo_DS_Manager( NDT_Root *Root_Ptr, NDT_Index_Id Index_Id, NDT_Node *Node_Ptr, NDT_Command Command, va_list Args)
|
||||||
|
{
|
||||||
|
NDT_Command_Name Command_Name;
|
||||||
|
|
||||||
|
|
||||||
|
switch( Command)
|
||||||
|
{
|
||||||
|
case NDD_CMD_MANAGER_VERSION:
|
||||||
|
{
|
||||||
|
NDT_Version_Name *Version_Name_Ptr = (NDT_Version_Name *)va_arg( Args, NDT_Version_Name *);
|
||||||
|
|
||||||
|
|
||||||
|
Command_Name = "NDD_CMD_MANAGER_VERSION";
|
||||||
|
|
||||||
|
*Version_Name_Ptr = "%Revision: 2.8 % %Name: libnode-2_1_0-1 % %Date: 2004/08/23 22:48:37 % %Author: agibert %";
|
||||||
|
|
||||||
|
return( NDS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
case NDD_CMD_INDEX_GET:
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
NDT_Index_Id *Reply_Index_Id_Ptr = (NDT_Index_Id *)va_arg( Args, NDT_Index_Id *);
|
||||||
|
NDT_Command *Reply_Command_Ptr = (NDT_Command *)va_arg( Args, NDT_Command *);
|
||||||
|
NDT_Command Cmd = (NDT_Command)va_arg( Args, NDT_Command);
|
||||||
|
void *Value_ptr = (void *)va_arg( Args, void *);
|
||||||
|
*/
|
||||||
|
NDT_Index_Id *Reply_Index_Id_Ptr = (NDT_Index_Id *)va_arg( Args, NDT_Index_Id *);
|
||||||
|
NDT_Command *Reply_Command_Ptr = (NDT_Command *)va_arg( Args, NDT_Command *);
|
||||||
|
NDT_Command Cmd = (NDT_Command)va_arg( Args, NDT_Command);
|
||||||
|
Demo_Value *Value_ptr = (Demo_Value *)va_arg( Args, Demo_Value *);
|
||||||
|
|
||||||
|
|
||||||
|
Command_Name = "NDD_CMD_INDEX_GET";
|
||||||
|
|
||||||
|
switch(Cmd)
|
||||||
|
{
|
||||||
|
case NDD_CMD_INDEX0_PRINT:
|
||||||
|
{
|
||||||
|
*Reply_Index_Id_Ptr = 0;
|
||||||
|
*Reply_Command_Ptr = NDD_CMD_VALUE_PRINT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case NDD_CMD_INDEX1_PRINT:
|
||||||
|
{
|
||||||
|
*Reply_Index_Id_Ptr = 1;
|
||||||
|
*Reply_Command_Ptr = NDD_CMD_VALUE_PRINT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case NDD_CMD_INDEX2_PRINT:
|
||||||
|
{
|
||||||
|
*Reply_Index_Id_Ptr = 2;
|
||||||
|
*Reply_Command_Ptr = NDD_CMD_VALUE_PRINT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case NDD_CMD_INDEX3_PRINT:
|
||||||
|
{
|
||||||
|
*Reply_Index_Id_Ptr = 3;
|
||||||
|
*Reply_Command_Ptr = NDD_CMD_VALUE_PRINT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
*Reply_Index_Id_Ptr = Index_Id;
|
||||||
|
*Reply_Command_Ptr = Cmd;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return( NDS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
case NDD_CMD_VALUE_ALLOC:
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
void **Value_Ptr_Ptr = (void **)va_arg( Args, void **);
|
||||||
|
va_list user_args = (va_list)va_arg( Args, va_list);
|
||||||
|
user_type user_data = (user_type)va_arg( user_args, user_type);
|
||||||
|
... = (...)va_arg( user_args, ...);
|
||||||
|
*/
|
||||||
|
Demo_Value **Value_Ptr_Ptr = va_arg( Args, Demo_Value **);
|
||||||
|
|
||||||
|
|
||||||
|
Command_Name = "NDD_CMD_VALUE_ALLOC";
|
||||||
|
|
||||||
|
if( ( *Value_Ptr_Ptr = (Demo_Value *)malloc( sizeof(Demo_Value))) == NULL)
|
||||||
|
{
|
||||||
|
return(NDS_ERRMEM);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
(*Value_Ptr_Ptr)->Val0[0] = '\0';
|
||||||
|
(*Value_Ptr_Ptr)->Val1[0] = '\0';
|
||||||
|
(*Value_Ptr_Ptr)->Val2[0] = '\0';
|
||||||
|
(*Value_Ptr_Ptr)->Val3[0] = '\0';
|
||||||
|
|
||||||
|
return( NDS_OK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case NDD_CMD_VALUE_FREE:
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
void *Value_Ptr = (void *)va_arg( Args, void *);
|
||||||
|
va_list user_args = (va_list)va_arg( Args, va_list);
|
||||||
|
user_type user_data = (user_type)va_arg( user_args, user_type);
|
||||||
|
... = (...)va_arg( user_args, ...);
|
||||||
|
*/
|
||||||
|
Demo_Value *Value_Ptr = (Demo_Value *)va_arg( Args, Demo_Value *);
|
||||||
|
|
||||||
|
|
||||||
|
Command_Name = "NDD_CMD_VALUE_FREE";
|
||||||
|
|
||||||
|
free( Value_Ptr);
|
||||||
|
|
||||||
|
return( NDS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
case NDD_CMD_VALUE_COMP:
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
void *Value1_Ptr = (void *)va_arg( Args, void *);
|
||||||
|
void *Value2_Ptr = (void *)va_arg( Args, void *);
|
||||||
|
va_list user_args = (va_list)va_arg( Args, va_list);
|
||||||
|
user_type user_data = (user_type)va_arg( user_args, user_type);
|
||||||
|
... = (...)va_arg( user_args, ...);
|
||||||
|
*/
|
||||||
|
Demo_Value *Value1_Ptr = va_arg( Args, Demo_Value *);
|
||||||
|
Demo_Value *Value2_Ptr = va_arg( Args, Demo_Value *);
|
||||||
|
|
||||||
|
|
||||||
|
Command_Name = "NDD_CMD_VALUE_COMP";
|
||||||
|
|
||||||
|
switch( Index_Id)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
|
||||||
|
rc = strcmp( Value1_Ptr->Val0, Value2_Ptr->Val0);
|
||||||
|
|
||||||
|
if( rc < 0)
|
||||||
|
{
|
||||||
|
return( NDS_LOWER);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( rc > 0)
|
||||||
|
{
|
||||||
|
return( NDS_GREATER);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return( NDS_EQUAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
int val1 = atoi( Value1_Ptr->Val1);
|
||||||
|
int val2 = atoi( Value2_Ptr->Val1);
|
||||||
|
|
||||||
|
|
||||||
|
if( val1 < val2)
|
||||||
|
{
|
||||||
|
return( NDS_LOWER);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( val1 > val2)
|
||||||
|
{
|
||||||
|
return( NDS_GREATER);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return( NDS_EQUAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
int val1 = strlen( Value1_Ptr->Val2);
|
||||||
|
int val2 = strlen( Value2_Ptr->Val2);
|
||||||
|
|
||||||
|
|
||||||
|
if( val1 < val2)
|
||||||
|
{
|
||||||
|
return( NDS_LOWER);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( val1 > val2)
|
||||||
|
{
|
||||||
|
return( NDS_GREATER);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return( NDS_EQUAL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
printf( "Unknown COMP idx (%d) !\n", Index_Id);
|
||||||
|
return( NDS_KO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return( NDS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
case NDD_CMD_VALUE_ADD:
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
void *Value_Ptr = (void *)va_arg( Args, void *);
|
||||||
|
va_list user_args = (va_list)va_arg( Args, va_list);
|
||||||
|
user_type user_data = (user_type)va_arg( user_args, user_type);
|
||||||
|
... = (...)va_arg( user_args, ...);
|
||||||
|
*/
|
||||||
|
|
||||||
|
Command_Name = "NDD_CMD_VALUE_ADD";
|
||||||
|
|
||||||
|
return( NDS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
case NDD_CMD_VALUE_REMOVE:
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
void *Value_Ptr = (void *)va_arg( Args, void *);
|
||||||
|
va_list user_args = (va_list)va_arg( Args, va_list);
|
||||||
|
user_type user_data = (user_type)va_arg( user_args, user_type);
|
||||||
|
... = (...)va_arg( user_args, ...);
|
||||||
|
*/
|
||||||
|
|
||||||
|
Command_Name = "NDD_CMD_VALUE_REMOVE";
|
||||||
|
|
||||||
|
return( NDS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
case NDD_CMD_VALUE_PRINT:
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
NDT_Node *Next_Node_Ptr = (NDT_Node *)va_arg( Args, NDT_Node *);
|
||||||
|
va_list lib_args = (va_list)va_arg( Args, va_list);
|
||||||
|
FILE *Out = (FILE *)va_arg( lib_args, FILE *);
|
||||||
|
NDT_Recursive_Mode Recursive_Mode = (NDT_Recursive_Mode)va_arg( lib_args, NDT_Recursive_Mode);
|
||||||
|
NDT_Recursive_Depth Recursive_Depth = (NDT_Recursive_Depth)va_arg( lib_args, NDT_Recursive_Depth);
|
||||||
|
va_list user_args = (va_list)va_arg( lib_args, va_list);
|
||||||
|
user_type user_data = (user_type)va_arg( user_args, user_type);
|
||||||
|
... = (...)va_arg( user_args, ...);
|
||||||
|
|
||||||
|
void *Value_Ptr = Node_Ptr->Value;
|
||||||
|
*/
|
||||||
|
NDT_Node *Next_Node_Ptr = (NDT_Node *)va_arg( Args, NDT_Node *);
|
||||||
|
va_list lib_args = (va_list)va_arg( Args, va_list);
|
||||||
|
FILE *Out = (FILE *)va_arg( lib_args, FILE *);
|
||||||
|
NDT_Recursive_Mode Recursive_Mode = (NDT_Recursive_Mode)va_arg( lib_args, NDT_Recursive_Mode);
|
||||||
|
NDT_Recursive_Depth Recursive_Depth = (NDT_Recursive_Depth)va_arg( lib_args, NDT_Recursive_Depth);
|
||||||
|
|
||||||
|
Demo_Value *Value_Ptr = Node_Ptr->Value;
|
||||||
|
|
||||||
|
|
||||||
|
Command_Name = "NDD_CMD_VALUE_PRINT";
|
||||||
|
|
||||||
|
fprintf( Out, "Val0: (%s) Val1: (%s) Val2: (%s) Val3: (%s)\n",
|
||||||
|
Value_Ptr->Val0, Value_Ptr->Val1, Value_Ptr->Val2, Value_Ptr->Val3);
|
||||||
|
|
||||||
|
return( NDS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
case NDD_CMD_INFO_PRINT:
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
NDT_Node *Next_Node_Ptr = (NDT_Node *)va_arg( Args, NDT_Node *);
|
||||||
|
va_list lib_args = (va_list)va_arg( Args, va_list);
|
||||||
|
FILE *Out = (FILE *)va_arg( lib_args, FILE *);
|
||||||
|
NDT_Recursive_Mode Recursive_Mode = (NDT_Recursive_Mode)va_arg( lib_args, NDT_Recursive_Mode);
|
||||||
|
NDT_Recursive_Depth Recursive_Depth = (NDT_Recursive_Depth)va_arg( lib_args, NDT_Recursive_Depth);
|
||||||
|
va_list user_args = (va_list)va_arg( lib_args, va_list);
|
||||||
|
user_type user_data = (user_type)va_arg( user_args, user_type);
|
||||||
|
... = (...)va_arg( user_args, ...);
|
||||||
|
|
||||||
|
void *Value_Ptr = Node_Ptr->Value;
|
||||||
|
*/
|
||||||
|
|
||||||
|
Command_Name = "NDD_CMD_INFO_PRINT";
|
||||||
|
|
||||||
|
return( NDS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
printf( "Demo_DS_Manager() called with an undefined command %d\n", Command);
|
||||||
|
return( NDS_ERRAPI);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "Demo_DS_Manager() called with command %d (%s)\n", Command, Command_Name);
|
||||||
|
return( NDS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void DataStruct_Load( NDT_Root *ds_ptr, FILE *demo_file)
|
||||||
|
{
|
||||||
|
NDT_Status status;
|
||||||
|
char *str;
|
||||||
|
char input_string[STRING_SIZE];
|
||||||
|
char val0[VAL_SIZE], val1[VAL_SIZE], val2[VAL_SIZE], val3[VAL_SIZE];
|
||||||
|
Demo_Value *value_ptr;
|
||||||
|
|
||||||
|
|
||||||
|
while( !feof( demo_file))
|
||||||
|
{
|
||||||
|
str = fgets( input_string, STRING_SIZE, demo_file);
|
||||||
|
if( ( (const int)str != EOF) && ( str != NULL))
|
||||||
|
{
|
||||||
|
if( strlen( input_string) >= STRING_LEN)
|
||||||
|
{
|
||||||
|
printf( "Input line too long ! Skipping ...");
|
||||||
|
|
||||||
|
while( !feof( demo_file) && strlen( input_string) >= STRING_LEN)
|
||||||
|
{
|
||||||
|
printf( ".");
|
||||||
|
str = fgets( input_string, STRING_SIZE, demo_file);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( input_string[0] != '#')
|
||||||
|
{
|
||||||
|
if( sscanf( input_string, "%s %s %s %s\n", val0, val1, val2, val3) != 4)
|
||||||
|
{
|
||||||
|
printf( "Input line scaning error... Skipping !\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf( "Input line read: \t(%s)\t(%s)\t(%s)\t(%s)\n", val0, val1, val2, val3);
|
||||||
|
printf( "Allocate Vallue: ");
|
||||||
|
|
||||||
|
if( ( status = ND_Value_Alloc( ds_ptr, (void **)&value_ptr)) != NDS_OK)
|
||||||
|
{
|
||||||
|
printf( "ND_Value_Alloc() failed (%d) !\n", status);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf( "Ok !\n");
|
||||||
|
|
||||||
|
strcpy( value_ptr->Val0, val0);
|
||||||
|
strcpy( value_ptr->Val1, val1);
|
||||||
|
strcpy( value_ptr->Val2, val2);
|
||||||
|
strcpy( value_ptr->Val3, val3);
|
||||||
|
|
||||||
|
printf( "Add Vallue: ");
|
||||||
|
|
||||||
|
if( ( status = ND_DataStruct_Value_Add( ds_ptr, (void **)value_ptr)) != NDS_OK)
|
||||||
|
{
|
||||||
|
printf( "ND_Value_Add() failed (%d) !\n", status);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf( "Ok !\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void DataStruct_Dump( NDT_Root *ds_ptr)
|
||||||
|
{
|
||||||
|
NDT_Status status;
|
||||||
|
|
||||||
|
|
||||||
|
printf( "Print DataStructure Info:\n");
|
||||||
|
|
||||||
|
if( ( status = ND_DataStruct_Info_Print( stdout, ds_ptr, NDD_RECURSIVE_MODE_PARENT_CHILD, 0, 0)) != NDS_OK)
|
||||||
|
{
|
||||||
|
printf( "ND_DataStruct_Info_Print() failed (%d) !\n", status);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
printf( "Traverse DataStructure Index 0:\n");
|
||||||
|
|
||||||
|
if( ( status = ND_DataStruct_Traverse( ds_ptr, NDD_CMD_INDEX0_PRINT, stdout, NDD_RECURSIVE_MODE_PARENT, 0)) != NDS_OK)
|
||||||
|
{
|
||||||
|
printf( "ND_DataStruct_Traverse() failed (%d) !\n", status);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
printf( "Traverse DataStructure Index 1:\n");
|
||||||
|
|
||||||
|
if( ( status = ND_DataStruct_Traverse( ds_ptr, NDD_CMD_INDEX1_PRINT, stdout, NDD_RECURSIVE_MODE_PARENT, 0)) != NDS_OK)
|
||||||
|
{
|
||||||
|
printf( "ND_DataStruct_Traverse() failed (%d) !\n", status);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
printf( "Traverse DataStructure Index 2:\n");
|
||||||
|
|
||||||
|
if( ( status = ND_DataStruct_Traverse( ds_ptr, NDD_CMD_INDEX2_PRINT, stdout, NDD_RECURSIVE_MODE_PARENT, 0)) != NDS_OK)
|
||||||
|
{
|
||||||
|
printf( "ND_DataStruct_Traverse() failed (%d) !\n", status);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
printf( "Traverse DataStructure Index 3:\n");
|
||||||
|
|
||||||
|
if( ( status = ND_DataStruct_Traverse( ds_ptr, NDD_CMD_INDEX3_PRINT, stdout, NDD_RECURSIVE_MODE_PARENT, 0)) != NDS_OK)
|
||||||
|
{
|
||||||
|
printf( "ND_DataStruct_Traverse() failed (%d) !\n", status);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void Demo( char *Demo_File_Name, short Optimized_Mode)
|
||||||
|
{
|
||||||
|
NDT_Status status;
|
||||||
|
NDT_Root *demo_ds_ptr;
|
||||||
|
NDT_Index_Type index_type_initial_tab[INDEX_NB] =
|
||||||
|
{
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO),
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO),
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO),
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO)
|
||||||
|
};
|
||||||
|
NDT_Index_Type index_type_final_tab[INDEX_NB] =
|
||||||
|
{
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_TREE | NDD_INDEX_SUBTYPE_BALANCED),
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_SORTED),
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_TREE | NDD_INDEX_SUBTYPE_BALANCED),
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO)
|
||||||
|
};
|
||||||
|
NDT_Index_Type *index_type_ptr;
|
||||||
|
FILE *demo_file;
|
||||||
|
|
||||||
|
|
||||||
|
printf( "Open library: ");
|
||||||
|
|
||||||
|
if( ( status = ND_Library_Open( NDD_TRUE)) != NDS_OK)
|
||||||
|
{
|
||||||
|
printf( "ND_Library_Open() failed (%d) !\n", status);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf( "Ok !\n");
|
||||||
|
|
||||||
|
printf( "Create demo DataStructure: ");
|
||||||
|
|
||||||
|
if( Optimized_Mode)
|
||||||
|
{
|
||||||
|
index_type_ptr = index_type_initial_tab;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
index_type_ptr = index_type_final_tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ( status = ND_DataStruct_Open( &demo_ds_ptr, INDEX_NB, index_type_ptr, "Demo_DS_Manager", Demo_DS_Manager, NULL, NULL, NULL, NULL,0, NULL)) != NDS_OK)
|
||||||
|
{
|
||||||
|
printf( "ND_DataStruct_Open() failed (%d) !\n", status);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf( "Ok !\n");
|
||||||
|
|
||||||
|
printf( "Open demo datafile: ");
|
||||||
|
|
||||||
|
if( ( demo_file = fopen( Demo_File_Name, "r")) == NULL)
|
||||||
|
{
|
||||||
|
printf( "fopen() failed (%d/%s) !\n", errno, strerror(errno));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf( "Ok !\n");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
printf( "\n\n\nLaod Data File:\n\n");
|
||||||
|
DataStruct_Load( demo_ds_ptr, demo_file);
|
||||||
|
|
||||||
|
if( Optimized_Mode)
|
||||||
|
{
|
||||||
|
printf( "\n\n\nInitial Structure Dump:\n\n");
|
||||||
|
DataStruct_Dump( demo_ds_ptr);
|
||||||
|
|
||||||
|
printf( "Convert data structure: ");
|
||||||
|
|
||||||
|
if( ( status = ND_DataStruct_Convert( demo_ds_ptr, index_type_final_tab)) != NDS_OK)
|
||||||
|
{
|
||||||
|
printf( "ND_DataStruct_Convert() failed (%d) !\n", status);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf( "Ok !\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
printf( "\n\n\nFinal Structure Dump:\n\n");
|
||||||
|
DataStruct_Dump( demo_ds_ptr);
|
||||||
|
|
||||||
|
printf( "Close demo datafile: ");
|
||||||
|
|
||||||
|
if( fclose( demo_file) != 0)
|
||||||
|
{
|
||||||
|
printf( "fclose() failed (%d/%s) !\n", errno, strerror(errno));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf( "Ok !\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
printf( "Close demo DataStructure: ");
|
||||||
|
|
||||||
|
if( ( status = ND_DataStruct_Close( demo_ds_ptr)) != NDS_OK)
|
||||||
|
{
|
||||||
|
printf( "ND_DataStruct_Close() failed (%d) !\n", status);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf( "Ok !\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( "Close library: ");
|
||||||
|
|
||||||
|
if( ( status = ND_Library_Close()) != NDS_OK)
|
||||||
|
{
|
||||||
|
printf( "ND_Library_Close() failed (%d) !\n", status);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf( "Ok !\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
int main( int argc, char **argv)
|
||||||
|
{
|
||||||
|
printf( "Non Optimized Demo\n------------------\n\n\n");
|
||||||
|
Demo( DEMO_FILE_NAME, 0);
|
||||||
|
|
||||||
|
printf( "\n\n\n\n\nOptimized Demo\n--------------\n\n\n");
|
||||||
|
Demo( DEMO_FILE_NAME, 1);
|
||||||
|
}
|
15
src/libnode/demo/nddemo0.dat
Normal file
15
src/libnode/demo/nddemo0.dat
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# %RCSfile: nddemo0.dat,v %
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
# %Revision: 2.1 %
|
||||||
|
# %Name: libnode-2_1_0-1 %
|
||||||
|
# %Date: 2003/07/16 00:17:02 %
|
||||||
|
# %Author: agibert %
|
||||||
|
#---------------------------------------------------------------------------------
|
||||||
|
ggg 1 xxxxxx example
|
||||||
|
aaa 7 x this
|
||||||
|
bbb 6 xxx is
|
||||||
|
ccc 5 xxxxx a
|
||||||
|
ddd 4 xxxx really
|
||||||
|
eee 3 xxxxxxx good
|
||||||
|
fff 2 xx libnode
|
926
src/libnode/include/node.h
Normal file
926
src/libnode/include/node.h
Normal file
@ -0,0 +1,926 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* $Workfile: node.h $ */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* $Author: agibert $ */
|
||||||
|
/* $Date: 2008/11/12 02:25:23 $ */
|
||||||
|
/* $Revision: 1.1 $ */
|
||||||
|
/* $Label: $ */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* %RCSfile: node.h,v % */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* %Revision: 2.12 % */
|
||||||
|
/* %Name: libnode-2_1_0-1 % */
|
||||||
|
/* %Date: 2005/01/20 00:00:25 % */
|
||||||
|
/* %Author: agibert % */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of LibNode */
|
||||||
|
/* */
|
||||||
|
/* LibNode is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU Lesser General Public Licence as published by */
|
||||||
|
/* the Free Software Foundation; either version 2.1 of the License, or */
|
||||||
|
/* (at your option) any later version. */
|
||||||
|
/* */
|
||||||
|
/* LibNode is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU Lesser General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU Lesser General Public License */
|
||||||
|
/* along with LibNode; if not, write to the Free Software */
|
||||||
|
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _LIBNODE_H_
|
||||||
|
# define _LIBNODE_H_
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <stdio.h>
|
||||||
|
# include <string.h>
|
||||||
|
# include <stdarg.h>
|
||||||
|
|
||||||
|
# ifdef _LIBVER_SUPPORT
|
||||||
|
# include <ver.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define NDD_TRUE 1
|
||||||
|
|
||||||
|
#define NDD_FALSE 0
|
||||||
|
|
||||||
|
#define NDD_MIN(A,B) ((A > B) ? B : A)
|
||||||
|
|
||||||
|
#define NDD_MAX(A,B) ((A < B) ? B : A)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Différence de profondeur entre la branche la plus courte et
|
||||||
|
la plus longue d'un arbre.
|
||||||
|
Le dépassement de ce seuil provoque le rééquilibrage de l'arbre
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define DEF_MAX_DIF 100
|
||||||
|
|
||||||
|
/* Types de structure */
|
||||||
|
|
||||||
|
typedef short NDT_Root_Type;
|
||||||
|
|
||||||
|
typedef int NDT_Index_Type;
|
||||||
|
|
||||||
|
#define NDD_INDEX_MSK 0xffff
|
||||||
|
#define NDD_INDEX_RMSK 0x0000
|
||||||
|
|
||||||
|
#define NDD_INDEX_STATUS_UNKNOWN 0x0000
|
||||||
|
#define NDD_INDEX_STATUS_OPENED 0x0001
|
||||||
|
#define NDD_INDEX_STATUS_CLOSED 0x0002
|
||||||
|
#define NDD_INDEX_STATUS_MSK (NDD_INDEX_STATUS_UNKNOWN | NDD_INDEX_STATUS_OPENED | NDD_INDEX_STATUS_CLOSED)
|
||||||
|
#define NDD_INDEX_STATUS_RMSK (NDD_INDEX_MSK ^ NDD_INDEX_STATUS_MSK)
|
||||||
|
|
||||||
|
#define ND_INDEX_STATUS_VALUE_UNKNOWN_IS( v) ( ( (v) & NDD_INDEX_STATUS_MSK) == NDD_INDEX_STATUS_UNKNOWN)
|
||||||
|
#define ND_INDEX_STATUS_VALUE_OPENED_IS( v) ( ( (v) & NDD_INDEX_STATUS_MSK) == NDD_INDEX_STATUS_OPENED)
|
||||||
|
#define ND_INDEX_STATUS_VALUE_CLOSED_IS( v) ( ( (v) & NDD_INDEX_STATUS_MSK) == NDD_INDEX_STATUS_CLOSED)
|
||||||
|
#define ND_INDEX_STATUS_UNKNOWN_IS( r, i) ND_INDEX_STATUS_VALUE_UNKNOWN_IS( (r)->Index_Tab[(i)].Type)
|
||||||
|
#define ND_INDEX_STATUS_OPENED_IS( r, i) ND_INDEX_STATUS_VALUE_OPENED_IS( (r)->Index_Tab[(i)].Type)
|
||||||
|
#define ND_INDEX_STATUS_CLOSED_IS( r, i) ND_INDEX_STATUS_VALUE_CLOSED_IS( (r)->Index_Tab[(i)].Type)
|
||||||
|
|
||||||
|
#define ND_INDEX_STATUS_VALUE_ASCII_GET( v) ( ND_INDEX_STATUS_VALUE_UNKNOWN_IS( (v)) ? "UNKNOWN" : ( ND_INDEX_STATUS_VALUE_OPENED_IS( (v)) ? "OPENED" : ( ND_INDEX_STATUS_VALUE_CLOSED_IS( (v)) ? "CLOSED" : "???")))
|
||||||
|
#define ND_INDEX_STATUS_ASCII_GET( r, i) ND_INDEX_STATUS_VALUE_ASCII_GET( (r)->Index_Tab[(i)].Type)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define NDD_INDEX_TYPE_UNKNOWN 0x0000
|
||||||
|
#define NDD_INDEX_TYPE_LIST 0x0010
|
||||||
|
#define NDD_INDEX_TYPE_TREE 0x0020
|
||||||
|
#define NDD_INDEX_TYPE_MSK (NDD_INDEX_TYPE_UNKNOWN | NDD_INDEX_TYPE_LIST | NDD_INDEX_TYPE_TREE)
|
||||||
|
#define NDD_INDEX_TYPE_RMSK (NDD_INDEX_MSK ^ NDD_INDEX_TYPE_MSK)
|
||||||
|
|
||||||
|
#define ND_INDEX_TYPE_VALUE_UNKNOWN_IS( v) ( ( (v) & NDD_INDEX_TYPE_MSK) == NDD_INDEX_TYPE_UNKNOWN)
|
||||||
|
#define ND_INDEX_TYPE_VALUE_LIST_IS( v) ( ( (v) & NDD_INDEX_TYPE_MSK) == NDD_INDEX_TYPE_LIST)
|
||||||
|
#define ND_INDEX_TYPE_VALUE_TREE_IS( v) ( ( (v) & NDD_INDEX_TYPE_MSK) == NDD_INDEX_TYPE_TREE)
|
||||||
|
|
||||||
|
#define ND_INDEX_TYPE_UNKNOWN_IS( r, i) ND_INDEX_TYPE_VALUE_UNKNOWN_IS( (r)->Index_Tab[(i)].Type)
|
||||||
|
#define ND_INDEX_TYPE_LIST_IS( r, i) ND_INDEX_TYPE_VALUE_LIST_IS( (r)->Index_Tab[(i)].Type)
|
||||||
|
#define ND_INDEX_TYPE_TREE_IS( r, i) ND_INDEX_TYPE_VALUE_TREE_IS( (r)->Index_Tab[(i)].Type)
|
||||||
|
|
||||||
|
#define ND_INDEX_TYPE_VALUE_ASCII_GET( v) ( ND_INDEX_TYPE_VALUE_UNKNOWN_IS( (v)) ? "UNKNOWN" : ( ND_INDEX_TYPE_VALUE_LIST_IS( (v)) ? "LIST" : ( ND_INDEX_TYPE_VALUE_TREE_IS( (v)) ? "TREE" : "???")))
|
||||||
|
|
||||||
|
#define ND_INDEX_TYPE_ASCII_GET( r, i) ND_INDEX_TYPE_VALUE_ASCII_GET( (r)->Index_Tab[(i)].Type)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define NDD_INDEX_SUBTYPE_UNKNOWN 0x0000
|
||||||
|
#define NDD_INDEX_SUBTYPE_FIFO 0x0100 /* principe de la file d'attente (First In First Out) */
|
||||||
|
#define NDD_INDEX_SUBTYPE_LILO NDD_INDEX_SUBTYPE_FIFO
|
||||||
|
#define NDD_INDEX_SUBTYPE_LIFO 0x0200 /* principe de la pile (First In Last Out) */
|
||||||
|
#define NDD_INDEX_SUBTYPE_FILO NDD_INDEX_SUBTYPE_LIFO
|
||||||
|
#define NDD_INDEX_SUBTYPE_SORTED 0x0300 /* liste triée */
|
||||||
|
#define NDD_INDEX_SUBTYPE_UNBALANCED 0x0400
|
||||||
|
#define NDD_INDEX_SUBTYPE_BALANCED 0x0500 /* arbre auto-équilibré */
|
||||||
|
#define NDD_INDEX_SUBTYPE_MSK ( NDD_INDEX_SUBTYPE_UNKNOWN | NDD_INDEX_SUBTYPE_FIFO | NDD_INDEX_SUBTYPE_FILO | NDD_INDEX_SUBTYPE_SORTED | NDD_INDEX_SUBTYPE_UNBALANCED | NDD_INDEX_SUBTYPE_BALANCED)
|
||||||
|
#define NDD_INDEX_SUBTYPE_RMSK (NDD_INDEX_MSK ^ NDD_INDEX_SUBTYPE_MSK)
|
||||||
|
|
||||||
|
#define ND_INDEX_SUBTYPE_VALUE_UNKNOWN_IS( v) ( ( (v) & NDD_INDEX_SUBTYPE_MSK) == NDD_INDEX_SUBTYPE_UNKNOWN)
|
||||||
|
#define ND_INDEX_SUBTYPE_VALUE_FIFO_IS( v) ( ( (v) & NDD_INDEX_SUBTYPE_MSK) == NDD_INDEX_SUBTYPE_FIFO)
|
||||||
|
#define ND_INDEX_SUBTYPE_VALUE_LILO_IS( v) ND_INDEX_SUBTYPE_VALUE_FIFO_IS( v)
|
||||||
|
#define ND_INDEX_SUBTYPE_VALUE_LIFO_IS( v) ( ( (v) & NDD_INDEX_SUBTYPE_MSK) == NDD_INDEX_SUBTYPE_LIFO)
|
||||||
|
#define ND_INDEX_SUBTYPE_VALUE_FILO_IS( v) ND_INDEX_SUBTYPE_LIFO_IS( r, i)
|
||||||
|
#define ND_INDEX_SUBTYPE_VALUE_SORTED_IS( v) ( ( (v) & NDD_INDEX_SUBTYPE_MSK) == NDD_INDEX_SUBTYPE_SORTED)
|
||||||
|
#define ND_INDEX_SUBTYPE_VALUE_UNBALANCED_IS( v) ( ( (v) & NDD_INDEX_SUBTYPE_MSK) == NDD_INDEX_SUBTYPE_UNBALANCED)
|
||||||
|
#define ND_INDEX_SUBTYPE_VALUE_BALANCED_IS( v) ( ( (v) & NDD_INDEX_SUBTYPE_MSK) == NDD_INDEX_SUBTYPE_BALANCED)
|
||||||
|
|
||||||
|
#define ND_INDEX_SUBTYPE_UNKNOWN_IS( r, i) ND_INDEX_SUBTYPE_VALUE_UNKNOWN_IS( (r)->Index_Tab[(i)].Type)
|
||||||
|
#define ND_INDEX_SUBTYPE_FIFO_IS( r, i) ND_INDEX_SUBTYPE_VALUE_FIFO_IS( (r)->Index_Tab[(i)].Type)
|
||||||
|
#define ND_INDEX_SUBTYPE_LILO_IS( r, i) ND_INDEX_SUBTYPE_VALUE_LILO_IS( (r)->Index_Tab[(i)].Type)
|
||||||
|
#define ND_INDEX_SUBTYPE_LIFO_IS( r, i) ND_INDEX_SUBTYPE_VALUE_LIFO_IS( (r)->Index_Tab[(i)].Type)
|
||||||
|
#define ND_INDEX_SUBTYPE_FILO_IS( r, i) ND_INDEX_SUBTYPE_VALUE_FILO_IS( (r)->Index_Tab[(i)].Type)
|
||||||
|
#define ND_INDEX_SUBTYPE_SORTED_IS( r, i) ND_INDEX_SUBTYPE_VALUE_SORTED_IS( (r)->Index_Tab[(i)].Type)
|
||||||
|
#define ND_INDEX_SUBTYPE_UNBALANCED_IS( r, i) ND_INDEX_SUBTYPE_VALUE_UNBALANCED_IS( (r)->Index_Tab[(i)].Type)
|
||||||
|
#define ND_INDEX_SUBTYPE_BALANCED_IS( r, i) ND_INDEX_SUBTYPE_VALUE_BALANCED_IS( (r)->Index_Tab[(i)].Type)
|
||||||
|
|
||||||
|
#define ND_INDEX_SUBTYPE_VALUE_ASCII_GET( v) ( ND_INDEX_SUBTYPE_VALUE_UNKNOWN_IS( v) ? "UNKNOWN" : ( ND_INDEX_SUBTYPE_VALUE_FIFO_IS( v) ? "FIFO" : ( ND_INDEX_SUBTYPE_VALUE_LIFO_IS( v) ? "LIFO" : ( ND_INDEX_SUBTYPE_VALUE_SORTED_IS( v) ? "SORTED" : ( ND_INDEX_SUBTYPE_VALUE_UNBALANCED_IS( v) ? "UNBALANCED" : ( ND_INDEX_SUBTYPE_VALUE_BALANCED_IS( v) ? "BALANCED" : "???"))))))
|
||||||
|
#define ND_INDEX_SUBTYPE_ASCII_GET( r, i) ND_INDEX_SUBTYPE_VALUE_ASCII_GET( (r)->Index_Tab[(i)].Type)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Commandes du manager */
|
||||||
|
|
||||||
|
typedef int NDT_Command;
|
||||||
|
|
||||||
|
#define NDD_CMD_UNKNOWN (NDT_Command)0
|
||||||
|
#define NDD_CMD_MANAGER_VERSION (NDT_Command)1
|
||||||
|
#define NDD_CMD_INDEX_GET (NDT_Command)2
|
||||||
|
#define NDD_CMD_VALUE_ALLOC (NDT_Command)3
|
||||||
|
#define NDD_CMD_VALUE_FREE (NDT_Command)4
|
||||||
|
#define NDD_CMD_VALUE_COMP (NDT_Command)5
|
||||||
|
#define NDD_CMD_VALUE_ADD (NDT_Command)6
|
||||||
|
#define NDD_CMD_VALUE_REMOVE (NDT_Command)7
|
||||||
|
#define NDD_CMD_VALUE_PRINT (NDT_Command)8
|
||||||
|
#define NDD_CMD_VALUE_FIND (NDT_Command)9
|
||||||
|
#define NDD_CMD_INFO_PRINT (NDT_Command)10
|
||||||
|
|
||||||
|
#define NDD_CMD_USER_TRAVERSE (NDT_Command)17
|
||||||
|
|
||||||
|
|
||||||
|
typedef char *NDT_Command_Name;
|
||||||
|
typedef char *NDT_Version_Name;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Types de réponse du manager ou code retour des diverses fonctions */
|
||||||
|
|
||||||
|
typedef int NDT_Status;
|
||||||
|
|
||||||
|
#define ND_ERROR(s) ((s) <= 0) /* All negative or 0 status are errors */
|
||||||
|
|
||||||
|
#define NDS_OK 1
|
||||||
|
#define NDS_KO 0
|
||||||
|
|
||||||
|
#define NDS_YES 1
|
||||||
|
#define NDS_NO 0
|
||||||
|
|
||||||
|
#define NDS_EQUAL 1
|
||||||
|
#define NDS_GREATER 2
|
||||||
|
#define NDS_LOWER 3
|
||||||
|
|
||||||
|
#define NDS_ERRMEM -1 /* Problème d'allocation mémoire */
|
||||||
|
#define NDS_ERRAPI -2 /* Utilisation incorrecte des API */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short NDT_Index_Id;
|
||||||
|
typedef short NDT_Index_Nb;
|
||||||
|
|
||||||
|
#define NDD_INDEX_UNKNOWN (NDT_Index_Id)-1
|
||||||
|
#define NDD_INDEX_PRIMARY (NDT_Index_Id)0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
struct NDT_Root;
|
||||||
|
struct NDT_Node;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Pointeur de fonction sur le manager */
|
||||||
|
|
||||||
|
#define NDD_MANAGER_NAME_LEN_MAX 64
|
||||||
|
#define NDD_MANAGER_NAME_SIZE_MAX (NDD_MANAGER_NAME_LEN_MAX + 1)
|
||||||
|
|
||||||
|
typedef char *NDT_Manager_Name;
|
||||||
|
|
||||||
|
typedef NDT_Status NDT_Manager( struct NDT_Root *, NDT_Index_Id, struct NDT_Node *, NDT_Command, va_list);
|
||||||
|
|
||||||
|
|
||||||
|
/* Pointeur de fonction sur l'allocateur */
|
||||||
|
|
||||||
|
#define NDD_ALLOCATOR_NAME_LEN_MAX 64
|
||||||
|
#define NDD_ALLOCATOR_NAME_SIZE_MAX (NDD_ALLOCATOR_NAME_LEN_MAX + 1)
|
||||||
|
|
||||||
|
typedef char *NDT_Allocator_Name;
|
||||||
|
|
||||||
|
typedef NDT_Status NDT_Allocator( void **, size_t, void *);
|
||||||
|
|
||||||
|
|
||||||
|
/* Pointeur de fonction sur le désallocateur */
|
||||||
|
|
||||||
|
#define NDD_DESALLOCATOR_NAME_LEN_MAX 64
|
||||||
|
#define NDD_DESALLOCATOR_NAME_SIZE_MAX (NDD_DESALLOCATOR_NAME_LEN_MAX + 1)
|
||||||
|
|
||||||
|
typedef char *NDT_Desallocator_Name;
|
||||||
|
|
||||||
|
typedef NDT_Status NDT_Desallocator( void *, void *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct NDT_Index
|
||||||
|
{
|
||||||
|
NDT_Index_Type Type; /* Type de la structure (liste, arbre ... ) */
|
||||||
|
|
||||||
|
long Node_Number; /* Nombre de noeuds dans la structure */
|
||||||
|
long Min_Depth; /* Profondeur minimale de l'arbre */
|
||||||
|
long Max_Depth; /* Profondeur maximale de l'arbre */
|
||||||
|
long Max_Dif; /* Différence maximale autorisée entre la branche la plus courte et la plus longue */
|
||||||
|
long Nb_Equ; /* Nombre de réquilibrages réalisés sur l'arbre */
|
||||||
|
struct NDT_Node *Head; /* Noeud de tête */
|
||||||
|
struct NDT_Node *Tail; /* Noeud de queue */
|
||||||
|
struct NDT_Node *Save; /* Pointeur de sauvegarde (utile pour la fonction de restauration) */
|
||||||
|
|
||||||
|
} NDT_Index;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct NDT_Root
|
||||||
|
{
|
||||||
|
/* NDT_Root_Type Type;*/ /* Root Structure Type */
|
||||||
|
/* NDT_DataStruct_Type DS_Type;*/ /* Type de la structure (liste, arbre ... ) */
|
||||||
|
|
||||||
|
NDT_Manager *Manager_Ptr; /* Pointeur sur la fonction manager */
|
||||||
|
char Manager_Name[NDD_MANAGER_NAME_SIZE_MAX]; /* Nom de la fonction manager */
|
||||||
|
NDT_Allocator *Allocator_Ptr; /* Pointeur sur la fonction d'allocation */
|
||||||
|
char Allocator_Name[NDD_ALLOCATOR_NAME_SIZE_MAX]; /* Nom de la fonction d'allocation */
|
||||||
|
NDT_Desallocator *Desallocator_Ptr; /* Pointeur sur la fonction de désallocation */
|
||||||
|
char Desallocator_Name[NDD_DESALLOCATOR_NAME_SIZE_MAX]; /* Nom de la fonction de désallocation */
|
||||||
|
|
||||||
|
short Own_Value; /* Indique si la structure est propriétaire de ses valeurs */
|
||||||
|
void *User_Ptr; /* Pointeur utilisable librement par l'utilisateur */
|
||||||
|
|
||||||
|
NDT_Index_Nb Index_Nb;
|
||||||
|
NDT_Index_Nb Index_Open_Count;
|
||||||
|
NDT_Index Index_Tab[1];
|
||||||
|
|
||||||
|
} NDT_Root;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct NDT_DataStruct
|
||||||
|
{
|
||||||
|
|
||||||
|
NDT_Root *Root_Ptr;
|
||||||
|
|
||||||
|
NDT_Manager *Manager_Ptr; /* Manager function pointer */
|
||||||
|
NDT_Allocator *Allocator_Ptr; /* Allocator function pointer */
|
||||||
|
NDT_Desallocator *Desallocator_Ptr; /* Desallocator function pointer */
|
||||||
|
|
||||||
|
} NDT_DataStruct;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Structure de noeud */
|
||||||
|
|
||||||
|
typedef struct NDT_Node
|
||||||
|
{
|
||||||
|
NDT_Root *Root;
|
||||||
|
NDT_Index_Id Index;
|
||||||
|
struct NDT_Node *Parent;
|
||||||
|
struct NDT_Node *Left;
|
||||||
|
struct NDT_Node *Right;
|
||||||
|
void *Value;
|
||||||
|
} NDT_Node;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef int NDT_Recursive_Mode;
|
||||||
|
typedef int NDT_Recursive_Depth;
|
||||||
|
typedef int NDT_Recursive_Offset;
|
||||||
|
|
||||||
|
#define NDD_RECURSIVE_MODE_UNKNOWN (NDT_Recursive_Mode)0x00
|
||||||
|
#define NDD_RECURSIVE_MODE_PARENT (NDT_Recursive_Mode)0x01
|
||||||
|
#define NDD_RECURSIVE_MODE_CHILD (NDT_Recursive_Mode)0x02
|
||||||
|
#define NDD_RECURSIVE_MODE_PARENT_CHILD (NDT_Recursive_Mode)0x03
|
||||||
|
|
||||||
|
#define ND_RECURSIVE_PARENT_IS(m) (m & NDD_RECURSIVE_MODE_PARENT)
|
||||||
|
#define ND_RECURSIVE_CHILD_IS(m) (m & NDD_RECURSIVE_MODE_CHILD)
|
||||||
|
|
||||||
|
#define ND_RECURSIVE_PRINT_OFFSET 8
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Définition des alias de l'API */
|
||||||
|
|
||||||
|
#ifndef ND_MODE
|
||||||
|
#define ND_MODE 0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ND_MODE == 1 /* API sans vérification des arguments */
|
||||||
|
|
||||||
|
#define ND_Library_Open ND_Library_Open_I
|
||||||
|
#define ND_Library_Close ND_Library_Close_I
|
||||||
|
#define ND_Library_StdErr_Set ND_Library_StdErr_Set_I
|
||||||
|
|
||||||
|
#define ND_DataStruct_Open ND_DataStruct_Open_I
|
||||||
|
#define ND_DataStruct_Close ND_DataStruct_Close_I
|
||||||
|
#define ND_DataStruct_Flush ND_DataStruct_Flush_I
|
||||||
|
#define ND_DataStruct_Check ND_DataStruct_Check_I
|
||||||
|
#define ND_DataStruct_Convert ND_DataStruct_Convert_I
|
||||||
|
#define ND_DataStruct_Reorg ND_DataStruct_Reorg_I
|
||||||
|
#define ND_DataStruct_Traverse_V ND_DataStruct_Traverse_VI
|
||||||
|
#define ND_DataStruct_Traverse ND_DataStruct_Traverse_I
|
||||||
|
#define ND_DataStruct_Info_Print ND_DataStruct_Info_Print_I
|
||||||
|
#define ND_DataStruct_Value_Add ND_DataStruct_Value_Add_I
|
||||||
|
#define ND_DataStruct_Value_Remove ND_DataStruct_Value_Remove_I
|
||||||
|
#define ND_DataStruct_Value_Print ND_DataStruct_Value_Print_I
|
||||||
|
#define ND_DataStruct_Value_Find ND_DataStruct_Value_Find_I
|
||||||
|
|
||||||
|
#define ND_Index_Open ND_Index_Open_I
|
||||||
|
#define ND_Index_Close ND_Index_Close_I
|
||||||
|
#define ND_Index_Flush ND_Index_Flush_I
|
||||||
|
#define ND_Index_Check ND_Index_Check_I
|
||||||
|
#define ND_Index_Convert ND_Index_Convert_I
|
||||||
|
#define ND_Index_Reorg ND_Index_Reorg_I
|
||||||
|
#define ND_Index_Traverse_V ND_Index_Traverse_VI
|
||||||
|
#define ND_Index_Traverse ND_Index_Traverse_I
|
||||||
|
#define ND_Index_Info_Print ND_Index_Info_Print_I
|
||||||
|
#define ND_Index_Value_Add ND_Index_Value_Add_I
|
||||||
|
#define ND_Index_Value_Remove ND_Index_Value_Remove_I
|
||||||
|
#define ND_Index_Value_Print ND_Index_Value_Print_I
|
||||||
|
#define ND_Index_Node_Add ND_Index_Node_Add_I
|
||||||
|
#define ND_Index_Node_Remove ND_Index_Node_Remove_I
|
||||||
|
#define ND_Index_Node_First_Get ND_Index_Node_First_Get_I
|
||||||
|
#define ND_Index_Node_Last_Get ND_Index_Node_Last_Get_I
|
||||||
|
#define ND_Index_Node_Next_Get ND_Index_Node_Next_Get_I
|
||||||
|
#define ND_Index_Node_Previous_Get ND_Index_Node_Previous_Get_I
|
||||||
|
#define ND_Index_Node_Find ND_Index_Node_Find_I
|
||||||
|
|
||||||
|
#define ND_Node_Root_Get ND_Node_Root_Get_I
|
||||||
|
|
||||||
|
#define ND_Value_Alloc ND_Value_Alloc_I
|
||||||
|
#define ND_Value_Free ND_Value_Free_I
|
||||||
|
|
||||||
|
#define ND_Manager_Exec_V ND_Manager_Exec_VI
|
||||||
|
#define ND_Manager_Exec ND_Manager_Exec_I
|
||||||
|
#define ND_Allocator_Exec ND_Allocator_Exec_I
|
||||||
|
#define ND_Desallocator_Exec ND_Desallocator_Exec_I
|
||||||
|
|
||||||
|
#else /* API avec vérification des arguments */
|
||||||
|
|
||||||
|
#define ND_Library_Open ND_Library_Open_C
|
||||||
|
#define ND_Library_Close ND_Library_Close_C
|
||||||
|
#define ND_Library_StdErr_Set ND_Library_StdErr_Set_C
|
||||||
|
|
||||||
|
#define ND_DataStruct_Open ND_DataStruct_Open_C
|
||||||
|
#define ND_DataStruct_Close ND_DataStruct_Close_C
|
||||||
|
#define ND_DataStruct_Flush ND_DataStruct_Flush_C
|
||||||
|
#define ND_DataStruct_Check ND_DataStruct_Check_C
|
||||||
|
#define ND_DataStruct_Convert ND_DataStruct_Convert_C
|
||||||
|
#define ND_DataStruct_Reorg ND_DataStruct_Reorg_C
|
||||||
|
#define ND_DataStruct_Traverse_V ND_DataStruct_Traverse_VC
|
||||||
|
#define ND_DataStruct_Traverse ND_DataStruct_Traverse_C
|
||||||
|
#define ND_DataStruct_Info_Print ND_DataStruct_Info_Print_C
|
||||||
|
#define ND_DataStruct_Value_Add ND_DataStruct_Value_Add_C
|
||||||
|
#define ND_DataStruct_Value_Remove ND_DataStruct_Value_Remove_C
|
||||||
|
#define ND_DataStruct_Value_Print ND_DataStruct_Value_Print_C
|
||||||
|
#define ND_DataStruct_Value_Find ND_DataStruct_Value_Find_C
|
||||||
|
|
||||||
|
#define ND_Index_Open ND_Index_Open_C
|
||||||
|
#define ND_Index_Close ND_Index_Close_C
|
||||||
|
#define ND_Index_Flush ND_Index_Flush_C
|
||||||
|
#define ND_Index_Check ND_Index_Check_C
|
||||||
|
#define ND_Index_Convert ND_Index_Convert_C
|
||||||
|
#define ND_Index_Reorg ND_Index_Reorg_C
|
||||||
|
#define ND_Index_Traverse_V ND_Index_Traverse_VC
|
||||||
|
#define ND_Index_Traverse ND_Index_Traverse_C
|
||||||
|
#define ND_Index_Info_Print ND_Index_Info_Print_C
|
||||||
|
#define ND_Index_Value_Add ND_Index_Value_Add_C
|
||||||
|
#define ND_Index_Value_Remove ND_Index_Value_Remove_C
|
||||||
|
#define ND_Index_Value_Print ND_Index_Value_Print_C
|
||||||
|
#define ND_Index_Node_Add ND_Index_Node_Add_C
|
||||||
|
#define ND_Index_Node_Remove ND_Index_Node_Remove_C
|
||||||
|
#define ND_Index_Node_First_Get ND_Index_Node_First_Get_C
|
||||||
|
#define ND_Index_Node_Last_Get ND_Index_Node_Last_Get_C
|
||||||
|
#define ND_Index_Node_Next_Get ND_Index_Node_Next_Get_C
|
||||||
|
#define ND_Index_Node_Previous_Get ND_Index_Node_Previous_Get_C
|
||||||
|
#define ND_Index_Node_Find ND_Index_Node_Find_C
|
||||||
|
|
||||||
|
#define ND_Node_Root_Get ND_Node_Root_Get_C
|
||||||
|
|
||||||
|
#define ND_Value_Alloc ND_Value_Alloc_C
|
||||||
|
#define ND_Value_Free ND_Value_Free_C
|
||||||
|
|
||||||
|
#define ND_Manager_Exec_V ND_Manager_Exec_VC
|
||||||
|
#define ND_Manager_Exec ND_Manager_Exec_C
|
||||||
|
#define ND_Allocator_Exec ND_Allocator_Exec_C
|
||||||
|
#define ND_Desallocator_Exec ND_Desallocator_Exec_C
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# if defined(_WIN32) && !defined(LIBNODE_STATIC)
|
||||||
|
# ifndef _LIBNODE_C_
|
||||||
|
# define NDD_DLL_API __declspec(dllimport)
|
||||||
|
# else
|
||||||
|
# define NDD_DLL_API __declspec(dllexport)
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
# define NDD_DLL_API
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Initialisation du contexte de la librairie */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Library_Open_I ( int Debug_Mode );
|
||||||
|
NDD_DLL_API NDT_Status ND_Library_Open_C ( int Debug_Mode );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Fermeture du contexte de la librairie */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Library_Close_I( void);
|
||||||
|
NDD_DLL_API NDT_Status ND_Library_Close_C( void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Définition de la sortie standard des messages d'erreur de la librairie */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Library_StdErr_Set_I( FILE *);
|
||||||
|
NDD_DLL_API NDT_Status ND_Library_StdErr_Set_C( FILE *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Création d'une nouvelle structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (O) Root: adresse d'un pointeur sur la racine de la nouvelle structure */
|
||||||
|
/* (I) Type: type de la structure.de données (liste ou arbre binaire) */
|
||||||
|
/* (I) Allocator: pointeur vers la fonction d'allocation */
|
||||||
|
/* (I) Desallocator: pointeur vers la fonction de désallocation */
|
||||||
|
/* (I) Data : pointeur de données utiles à l'allocateur */
|
||||||
|
/* (I) Own_Value : indique si la structure est propriétaire de ses valeurs */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Open_I( NDT_Root **, NDT_Index_Nb, NDT_Index_Type *, NDT_Manager_Name, NDT_Manager *, NDT_Allocator_Name, NDT_Allocator *, NDT_Desallocator_Name, NDT_Desallocator *, short, void *);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Open_C( NDT_Root **, NDT_Index_Nb, NDT_Index_Type *, NDT_Manager_Name, NDT_Manager *, NDT_Allocator_Name, NDT_Allocator *, NDT_Desallocator_Name, NDT_Desallocator *, short, void *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Destruction d'une structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (O) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Close_I( NDT_Root *);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Close_C( NDT_Root *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Destruction d'une structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (O) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Flush_I( NDT_Root *);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Flush_C( NDT_Root *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Function de réparation d'une structure : */
|
||||||
|
/* - vérifie que tous les noeuds sont correctement liés les uns aux autres */
|
||||||
|
/* - corrige les informations statistiques de la racine */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine de la structure */
|
||||||
|
/* (O) Nb_Detected : pointeur sur le nombre d'erreurs */
|
||||||
|
/* (O) Nb_Corrected : pointeur sur le nombre d'erreurs */
|
||||||
|
/* (I) Out : flux de sortie du rapport */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Check_I( NDT_Root *, int *, int *, FILE *);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Check_C( NDT_Root *, int *, int *, FILE *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Réorganisation d'une structure de données : */
|
||||||
|
/* - ordonnancement d'une liste non ordonnée */
|
||||||
|
/* - réquilibrage d'un arbre non auto-équilibré */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Reorg_I( NDT_Root *);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Reorg_C( NDT_Root *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Conversion d'une structure de données d'un type en un autre */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/* (I) Target_Type: type de structure cible */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Convert_I( NDT_Root *, NDT_Index_Type *);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Convert_C( NDT_Root *, NDT_Index_Type *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Parcours de tous les noeuds d'une structure de données et exécution d'une */
|
||||||
|
/* commande sur chacun d'eux */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/* (I) Command: Commande à exécuter sur chaque noeud traversé */
|
||||||
|
/* (I) Data: pointeur de données utilisateur */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Traverse_VI( NDT_Root *, NDT_Command, va_list);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Traverse_VC( NDT_Root *, NDT_Command, va_list);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Traverse_I( NDT_Root *, NDT_Command, ...);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Traverse_C( NDT_Root *, NDT_Command, ...);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Affichage d'informations sur une structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/* (I) Out : flux de sortie */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Info_Print_I( FILE *, NDT_Root *, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Info_Print_C( FILE *, NDT_Root *, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Ajout d'une valeur à une structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/* (I) Value: pointeur sur la valeur à ajouter */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Value_Add_I( NDT_Root *, void *);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Value_Add_C( NDT_Root *, void *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Suppression du premier noeud correspondant à une valeur donnée */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine de la structure de données */
|
||||||
|
/* (I) Reference_Value : pointeur sur la valeur de référence */
|
||||||
|
/* (I) Removed_Value : adresse d'un pointeur sur la valeur supprimée */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Value_Remove_I( NDT_Root *, void *);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Value_Remove_C( NDT_Root *, void *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Affichage de la valeur de tous les noeuds d'une structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/* (I) Out : flux de sortie */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Value_Print_VI( FILE *, NDT_Root *, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset, va_list);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Value_Print_I( FILE *, NDT_Root *, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset, ...);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Value_Print_C( FILE *, NDT_Root *, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset, ...);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Recherche un noeud à partir d'une valeur */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine de l'abre */
|
||||||
|
/* (O) Node : pointeur sur le noeud à récuperer */
|
||||||
|
/* (I) Value : pointeur sur la valeur à rechercher */
|
||||||
|
/* (I) Data : pointeur de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Value_Find_VI( void **, NDT_Root *, void *, va_list);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Value_Find_VC( void **, NDT_Root *, void *, va_list);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Value_Find_I( void **, NDT_Root *, void *, ...);
|
||||||
|
NDD_DLL_API NDT_Status ND_DataStruct_Value_Find_C( void **, NDT_Root *, void *, ...);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Create a new index (not yet implemented !) */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (O) Root: adresse d'un pointeur sur la racine de la nouvelle structure */
|
||||||
|
/* (I) Type: type de la structure.de données (liste ou arbre binaire) */
|
||||||
|
/* (I) Allocator: pointeur vers la fonction d'allocation */
|
||||||
|
/* (I) Desallocator: pointeur vers la fonction de désallocation */
|
||||||
|
/* (I) Data : pointeur de données utiles à l'allocateur */
|
||||||
|
/* (I) Own_Value : indique si la structure est propriétaire de ses valeurs */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Open_I( NDT_Root *, NDT_Index_Id, NDT_Index_Type);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Open_C( NDT_Root *, NDT_Index_Id, NDT_Index_Type);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Remove an Index (not yet implemented !) */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (O) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Close_I( NDT_Root *, NDT_Index_Id);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Close_C( NDT_Root *, NDT_Index_Id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Remove an Index (not yet implemented !) */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (O) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Flush_I( NDT_Root *, NDT_Index_Id);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Flush_C( NDT_Root *, NDT_Index_Id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Function de réparation d'une structure : */
|
||||||
|
/* - vérifie que tous les noeuds sont correctement liés les uns aux autres */
|
||||||
|
/* - corrige les informations statistiques de la racine */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine de la structure */
|
||||||
|
/* (O) Nb_Detected : pointeur sur le nombre d'erreurs */
|
||||||
|
/* (O) Nb_Corrected : pointeur sur le nombre d'erreurs */
|
||||||
|
/* (I) Out : flux de sortie du rapport */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Check_I( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Check_C( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Conversion d'une structure de données d'un type en un autre */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/* (I) Target_Type: type de structure cible */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Convert_I ( NDT_Root *, NDT_Index_Id, NDT_Index_Type);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Convert_C ( NDT_Root *, NDT_Index_Id, NDT_Index_Type);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Réorganisation d'une structure de données : */
|
||||||
|
/* - ordonnancement d'une liste non ordonnée */
|
||||||
|
/* - réquilibrage d'un arbre non auto-équilibré */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Reorg_I( NDT_Root *, NDT_Index_Id);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Reorg_C( NDT_Root *, NDT_Index_Id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Parcours de tous les noeuds d'une structure de données et exécution d'une */
|
||||||
|
/* commande sur chacun d'eux */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/* (I) Command: Commande à exécuter sur chaque noeud traversé */
|
||||||
|
/* (I) Data: pointeur de données utilisateur */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Traverse_VI( NDT_Root *, NDT_Index_Id, NDT_Command, va_list);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Traverse_VC( NDT_Root *, NDT_Index_Id, NDT_Command, va_list);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Traverse_I( NDT_Root *, NDT_Index_Id, NDT_Command, ...);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Traverse_C( NDT_Root *, NDT_Index_Id, NDT_Command, ...);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Parcours de tous les noeuds d'une structure de données et exécution d'une */
|
||||||
|
/* commande sur chacun d'eux */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/* (I) Command: Commande à exécuter sur chaque noeud traversé */
|
||||||
|
/* (I) Data: pointeur de données utilisateur */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Info_Print_I( FILE *, NDT_Root *, NDT_Index_Id, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Info_Print_C( FILE *, NDT_Root *, NDT_Index_Id, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Ajout d'une valeur à une structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/* (I) Value: pointeur sur la valeur à ajouter */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Value_Add_I( NDT_Root *, NDT_Index_Id, void *);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Value_Add_C( NDT_Root *, NDT_Index_Id, void *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Suppression du premier noeud correspondant à une valeur donnée */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine de la structure de données */
|
||||||
|
/* (I) Reference_Value : pointeur sur la valeur de référence */
|
||||||
|
/* (I) Removed_Value : adresse d'un pointeur sur la valeur supprimée */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Value_Remove_I( NDT_Root *, NDT_Index_Id, void *);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Value_Remove_C( NDT_Root *, NDT_Index_Id, void *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Affichage de la valeur de tous les noeuds d'une structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/* (I) Out : flux de sortie */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Value_Print_VI( FILE *, NDT_Root *, NDT_Index_Id, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset, va_list);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Value_Print_I( FILE *, NDT_Root *, NDT_Index_Id, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset, ...);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Value_Print_C( FILE *, NDT_Root *, NDT_Index_Id, NDT_Recursive_Mode, NDT_Recursive_Depth, NDT_Recursive_Offset, ...);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Ajout d'un noeud à une structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/* (I) Node: pointeur sur le noeud à ajouter */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Node_Add_I( NDT_Root *, NDT_Index_Id, NDT_Node *);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Node_Add_C( NDT_Root *, NDT_Index_Id, NDT_Node *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Suppression d'un noeud dans une structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Node: pointeur sur le noeud à supprimer de la structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Node_Remove_I( NDT_Node *);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Node_Remove_C( NDT_Node *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Récupération du premier noeud d'une structure */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine dont on cherche le premier noeud */
|
||||||
|
/* (O) Node : pointeur sur le noeud à récupérer */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Node_First_Get_I( NDT_Node **, NDT_Root *, NDT_Index_Id);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Node_First_Get_C( NDT_Node **, NDT_Root *, NDT_Index_Id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Récupération du dernier noeud d'une structure */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root: pointeur sur la racine dont on cherche le dernier noeud */
|
||||||
|
/* (O) Node : pointeur sur le noeud à récupérer */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Node_Last_Get_I( NDT_Node **, NDT_Root *, NDT_Index_Id);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Node_Last_Get_C( NDT_Node **, NDT_Root *, NDT_Index_Id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Récupération du noeud suivant */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Node: pointeur sur le noeud dont on cherche le suivant */
|
||||||
|
/* (O) Next_Node : pointeur sur le noeud suivant */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Node_Next_Get_I( NDT_Node **, NDT_Node *);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Node_Next_Get_C( NDT_Node **, NDT_Node *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Récupération du noeud précédant */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Node: pointeur sur le noeud dont on cherche le précédant */
|
||||||
|
/* (O) Prev_Node : pointeur sur le noeud précédant */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Node_Previous_Get_I( NDT_Node **, NDT_Node *);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Node_Previous_Get_C( NDT_Node **, NDT_Node *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Recherche un noeud à partir d'une valeur */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine de l'abre */
|
||||||
|
/* (O) Node : pointeur sur le noeud à récuperer */
|
||||||
|
/* (I) Value : pointeur sur la valeur à rechercher */
|
||||||
|
/* (I) Data : pointeur de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Node_Find_VI( NDT_Node **, NDT_Root *, NDT_Index_Id, void *, va_list);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Node_Find_VC( NDT_Node **, NDT_Root *, NDT_Index_Id, void *, va_list);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Node_Find_I( NDT_Node **, NDT_Root *, NDT_Index_Id, void *, ...);
|
||||||
|
NDD_DLL_API NDT_Status ND_Index_Node_Find_C( NDT_Node **, NDT_Root *, NDT_Index_Id, void *, ...);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Récupération de la racine d'une structure */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (O) Root: Adresse du pointeur sur la racine à récupérer */
|
||||||
|
/* (I) Node: pointeur sur le noeud dont on cherche la racine */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Node_Root_Get_I( NDT_Root **, NDT_Node *);
|
||||||
|
NDD_DLL_API NDT_Status ND_Node_Root_Get_C( NDT_Root **, NDT_Node *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Allocation d'une valeur d'une structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine de la structure de données */
|
||||||
|
/* (O) Value : adresse d'un pointeur sur la valeur à allouer */
|
||||||
|
/* (I) ... : arguments relatifs à l'allocation de la valeur */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Value_Alloc_I( NDT_Root *, void **, ...);
|
||||||
|
NDD_DLL_API NDT_Status ND_Value_Alloc_C( NDT_Root *, void **, ...);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Désallocation d'une valeur d'une structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root: pointeur sur la racine de la structure de données */
|
||||||
|
/* (I) Value: pointeur sur la valeur à désallouer */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Value_Free_I( NDT_Root *, void *);
|
||||||
|
NDD_DLL_API NDT_Status ND_Value_Free_C( NDT_Root *, void *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Exécution d'une fonction Manager dont le nom est passé en paramètre */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Function : nom de la fonction manager à exécuter */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Manager_Exec_VI( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
NDD_DLL_API NDT_Status ND_Manager_Exec_VC( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
NDD_DLL_API NDT_Status ND_Manager_Exec_I( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, ...);
|
||||||
|
NDD_DLL_API NDT_Status ND_Manager_Exec_C( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, ...);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Exécution d'une fonction d'allocation dont le nom est passé en paramètre */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Function : nom de la fonction à exécuter */
|
||||||
|
/* (O) Ptr : adresse d'un pointeur sur la zone à allouer */
|
||||||
|
/* (I) Size : taille de la zone à allouer */
|
||||||
|
/* (I) Data : pointeur de données utiles à l'allocateur */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Allocator_Exec_I( void **, size_t, NDT_Allocator_Name, NDT_Allocator *, void *);
|
||||||
|
NDD_DLL_API NDT_Status ND_Allocator_Exec_C( void **, size_t, NDT_Allocator_Name, NDT_Allocator *, void *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Exécution d'une fonction de désallocation le dont nom est passé en paramètre */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Function : nom de la fonction à exécuter */
|
||||||
|
/* (I) Function : nom de la fonction à exécuter */
|
||||||
|
/* (I) Ptr : adresse de la zone à désallouer */
|
||||||
|
/* (I) Data : pointeur de données utiles au désallocateur */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDD_DLL_API NDT_Status ND_Desallocator_Exec_I( void *, NDT_Desallocator_Name, NDT_Desallocator *, void *);
|
||||||
|
NDD_DLL_API NDT_Status ND_Desallocator_Exec_C( void *, NDT_Desallocator_Name, NDT_Desallocator *, void *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef __cplusplus
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#endif
|
42
src/libnode/src/Makefile
Normal file
42
src/libnode/src/Makefile
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Local Makefile
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Workfile: Makefile $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Author: agibert $
|
||||||
|
# $Date: 2008/11/12 02:25:23 $
|
||||||
|
# $Revision: 1.1 $
|
||||||
|
# $Label: $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Var include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include ../../Makefile_var.mk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Variables
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
TARGET= libnode$(SHLIB_SUFFIX)
|
||||||
|
|
||||||
|
OBJ= libnode.o
|
||||||
|
|
||||||
|
#EXTRA_INC=
|
||||||
|
|
||||||
|
#EXTRA_LIB=
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Rule include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include ../../Makefile_rule.mk
|
5819
src/libnode/src/libnode.c
Normal file
5819
src/libnode/src/libnode.c
Normal file
File diff suppressed because it is too large
Load Diff
356
src/libnode/src/libnode.h
Normal file
356
src/libnode/src/libnode.h
Normal file
@ -0,0 +1,356 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* $Workfile: libnode.h $ */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* $Author: agibert $ */
|
||||||
|
/* $Date: 2008/11/12 02:25:23 $ */
|
||||||
|
/* $Revision: 1.1 $ */
|
||||||
|
/* $Label: $ */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* %RCSfile: libnode.h,v % */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* %Revision: 2.9 % */
|
||||||
|
/* %Name: libnode-2_1_0-1 % */
|
||||||
|
/* %Date: 2005/01/19 23:59:42 % */
|
||||||
|
/* %Author: agibert % */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of LibNode */
|
||||||
|
/* */
|
||||||
|
/* LibNode is free software; you can redistribute it and/or modify */
|
||||||
|
/* it under the terms of the GNU Lesser General Public Licence as published by */
|
||||||
|
/* the Free Software Foundation; either version 2.1 of the License, or */
|
||||||
|
/* (at your option) any later version. */
|
||||||
|
/* */
|
||||||
|
/* LibNode is distributed in the hope that it will be useful, */
|
||||||
|
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
|
||||||
|
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
|
||||||
|
/* GNU Lesser General Public License for more details. */
|
||||||
|
/* */
|
||||||
|
/* You should have received a copy of the GNU Lesser General Public License */
|
||||||
|
/* along with LibNode; if not, write to the Free Software */
|
||||||
|
/* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <setjmp.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Utilisation des API de la LIBNODE sans vérification des arguments */
|
||||||
|
|
||||||
|
#define ND_MODE 1
|
||||||
|
|
||||||
|
#include <node.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __linux
|
||||||
|
# define NDD_PRINTF_PTR_PREFIX ""
|
||||||
|
#else
|
||||||
|
# define NDD_PRINTF_PTR_PREFIX "0x"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define NDD_HUGE_LONG ( long) 0xFFFFFFL
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Table des symboles locale */
|
||||||
|
|
||||||
|
struct NDT_Symbol;
|
||||||
|
|
||||||
|
typedef struct NDT_Symbol
|
||||||
|
{
|
||||||
|
void *Ptr;
|
||||||
|
char *Name;
|
||||||
|
struct NDT_Symbol *Next;
|
||||||
|
} NDT_Symbol;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* LibNode Global Base Structure */
|
||||||
|
|
||||||
|
typedef struct NDT_Base
|
||||||
|
{
|
||||||
|
int Open_Status;
|
||||||
|
int Debug_Mode;
|
||||||
|
char Err_String[512];
|
||||||
|
FILE *Err_Stream;
|
||||||
|
int Sig_Trapped;
|
||||||
|
#if !defined(_WIN32)
|
||||||
|
sigjmp_buf SigLongJmp_Env;
|
||||||
|
#else
|
||||||
|
jmp_buf SigLongJmp_Env;
|
||||||
|
#endif
|
||||||
|
NDT_Symbol *Symbol_First_Ptr;
|
||||||
|
void *DL_Ptr;
|
||||||
|
NDT_Index_Type OpenStruct_Index_Type[1];
|
||||||
|
NDT_Root *OpenStruct_Ptr;
|
||||||
|
} NDT_Base;
|
||||||
|
|
||||||
|
NDT_Base NDG_Base =
|
||||||
|
{
|
||||||
|
NDD_FALSE,
|
||||||
|
NDD_TRUE,
|
||||||
|
"",
|
||||||
|
(FILE *) -1,
|
||||||
|
0,
|
||||||
|
{0},
|
||||||
|
(NDT_Symbol *) NULL,
|
||||||
|
NULL,
|
||||||
|
{ NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_FIFO},
|
||||||
|
(NDT_Root *) NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Fonctions et procédures privées de la librairie (moyen niveau) */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Manager par défaut */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) va_list Arguments : Liste d'arguments contextuels */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_Default_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* OpenStruct Manager */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) va_list Arguments : Liste d'arguments contextuels */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_OpenStruct_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Redéfinition de la fonction malloc() avec retour de type NDT_Status */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_Default_Allocator( void **, size_t, void *);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Redéfinition de la fonction free() avec retour de type NDT_Status */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_Default_Desallocator( void *, void *);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Création d'un noeud */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : adresse de la racine pour laquelle on crée un noeud */
|
||||||
|
/* (O) New_Node : adresse du pointeur sur le nouveau noeud */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_Node_Alloc( NDT_Root * Root, NDT_Node ** New_Node);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Destruction d'un noeud */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : adresse de la racine dans laquelle on détruit un noeud */
|
||||||
|
/* (I) Node : pointeur sur le noeud à détruire */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_Node_Free( NDT_Root *, NDT_Node *);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Création d'une nouvelle structure de données */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (O) Root: adresse d'un pointeur sur la racine de la nouvelle structure */
|
||||||
|
/* (I) Type: type de la structure.de données (liste ou arbre binaire) */
|
||||||
|
/* (I) Allocator: pointeur vers la fonction d'allocation */
|
||||||
|
/* (I) Desallocator: pointeur vers la fonction de désallocation */
|
||||||
|
/* (I) Data : pointeur de données utiles à l'allocateur */
|
||||||
|
/* (I) Own_Value : indique si la structure est propriétaire de ses valeurs */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_Index_Clear( NDT_Root *, NDT_Index_Id);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Création de la racine d'une structure de données quelconque */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (O) New_Root : adresse du pointeur sur la nouvelle racine */
|
||||||
|
/* (I) Type : type de la structure de données */
|
||||||
|
/* (I) Allocater : pointeur vers la fonction d'allocation */
|
||||||
|
/* (I) Desallocater : pointeur vers la fonction de désallocation */
|
||||||
|
/* (I) Data : pointeur de données utiles à l'allocateur */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_Node_Root_Alloc( NDT_Root **, NDT_Index_Nb, NDT_Index_Type[], char *, NDT_Manager *, char *, NDT_Allocator *, char *, NDT_Desallocator *, short, void *);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Destruction d'une racine */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine à détruire */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_Node_Root_Free( NDT_Root *);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Ajout d'un noeud à une liste chaînée */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine de la liste */
|
||||||
|
/* (I) New_Node : pointeur sur le noeud à ajouter */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_List_Node_Add( NDT_Root *, NDT_Index_Id, NDT_Node *);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Ajout d'une nouvelle valeur à une liste */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine de la liste */
|
||||||
|
/* (I) Value : pointeur sur la valeur à ajouter */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_List_Value_Add( NDT_Root *, NDT_Index_Id, void *);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Ajout d'un noeud à un arbre binaire */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine de l'arbre */
|
||||||
|
/* (I) Value : pointeur sur la valeur à ajouter */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_Tree_Value_Add( NDT_Root *, NDT_Index_Id, void *);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Supprime le noeud d'une liste */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Node : pointeur sur le noeud à supprimer */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_List_Node_Remove( NDT_Node *);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Conversion d'une structure en liste chaînée */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine du la structure à convertir */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_List_Make( NDT_Root *, NDT_Index_Id);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Recherche une valeur dans une liste et retourne le noeud correspondant */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Node *ND_List_Node_Find( NDT_Root *, NDT_Index_Id, void *, va_list);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Recherche un noeud dans un arbre et retourne le pointeur sur le noeud */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Node *ND_Tree_Node_Find( NDT_Root *, NDT_Index_Id, void *, va_list);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Conversion d'une structure en arbre binaire */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine du la structure à convertir */
|
||||||
|
/* (I) Type : type du futur arbre */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_Tree_Make( NDT_Root *, NDT_Index_Id);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Equilibrage d'un arbre */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine de l'arbre */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_Tree_Equalize( NDT_Root *, NDT_Index_Id);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Retourne la profondeur de la plus grande branche à partir d'un noeud */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Node : pointeur sur le noeud */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
long ND_Tree_MaxDepth_Get( NDT_Node *);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Retourne la profondeur de la plus petite branche à partir d'un noeud */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Node : pointeur sur le noeud */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
long ND_Tree_MinDepth_Get( NDT_Node *);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Ajout d'un noeud à un arbre binaire */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine de l'arbre */
|
||||||
|
/* (I) Node : pointeur sur le noeud à ajouter */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_Tree_Node_Add( NDT_Root *, NDT_Index_Id, NDT_Node *);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Ajoute tous les noeud d'une liste à un arbre */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Tree_Root : pointeur sur la racine de l'arbre */
|
||||||
|
/* (I) List_Root : pointeur sur la racine de la liste */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_Tree_List_Add( NDT_Root *, NDT_Index_Id, NDT_Root *, NDT_Index_Id);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Fonction de comparaison de noeuds (pour le quick sort) */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
int ND_Node_Compare( void **, void **);
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* Ordonne une liste chaînée selon l'algorithme du tri à bulle */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* (I) Root : pointeur sur la racine de la liste à trier */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
NDT_Status ND_List_Sort( NDT_Root *, NDT_Index_Id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/* PRIVATE FUNCTIONS */
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
/*------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
void ND_List_Check( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
|
||||||
|
|
||||||
|
void ND_List_Link_Check( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
|
||||||
|
|
||||||
|
void ND_Value_Check( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
|
||||||
|
|
||||||
|
void ND_Tree_Check( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
|
||||||
|
|
||||||
|
void ND_Tree_Link_Check( NDT_Root *, NDT_Index_Id, int *, int *, FILE *);
|
||||||
|
|
||||||
|
NDT_Status ND_List_Recursive_Make( NDT_Node *, NDT_Root *, NDT_Index_Id);
|
||||||
|
|
||||||
|
NDT_Node *ND_Tree_Recursive_Make( long, long, NDT_Node *);
|
||||||
|
|
||||||
|
void ND_Tree_Node_Recursive_Add( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Node **, long , NDT_Node *);
|
||||||
|
|
||||||
|
NDT_Node *ND_Tree_Node_First_Recursive_Get( NDT_Node *);
|
||||||
|
|
||||||
|
NDT_Node *ND_Tree_Node_Last_Recursive_Get( NDT_Node *);
|
||||||
|
|
||||||
|
NDT_Node *ND_Tree_Node_Recursive_Find( NDT_Node *, void *, va_list);
|
||||||
|
|
||||||
|
NDT_Node *ND_Tree_Parent_Next_Recursive_Get( NDT_Node *);
|
||||||
|
|
||||||
|
NDT_Node *ND_Tree_Parent_Previous_Recursive_Get( NDT_Node *);
|
||||||
|
|
||||||
|
void ND_Tree_Recursive_Print( NDT_Node *, long, FILE *);
|
||||||
|
|
||||||
|
void ND_Tree_Link_Recursive_Check( NDT_Node *, int *, int *, FILE *);
|
||||||
|
|
||||||
|
NDT_Status ND_Symbol_Find( void **, const char *);
|
||||||
|
|
||||||
|
void ND_Error_Print( void);
|
||||||
|
|
||||||
|
void ND_Signal_Trap( int);
|
||||||
|
|
||||||
|
NDT_Status ND_Address_Check( void *);
|
1602
src/libnode/util/ndbench.c
Normal file
1602
src/libnode/util/ndbench.c
Normal file
File diff suppressed because it is too large
Load Diff
10
src/libnode/util/test-10-s.ndb
Normal file
10
src/libnode/util/test-10-s.ndb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Lib_Open 0
|
||||||
|
DS_Open 1
|
||||||
|
Index_List_Open 0-0
|
||||||
|
DS_Value_Add 1-10 0
|
||||||
|
DS_Value_Find 1-10
|
||||||
|
Index_List_To_Tree 0-0
|
||||||
|
DS_Value_Find 1-10
|
||||||
|
DS_Check
|
||||||
|
DS_Close
|
||||||
|
Lib_Close
|
10
src/libnode/util/test-10.ndb
Normal file
10
src/libnode/util/test-10.ndb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Lib_Open 0
|
||||||
|
DS_Open 0
|
||||||
|
Index_List_Open 0-0
|
||||||
|
DS_Value_Add 1-10 0
|
||||||
|
DS_Value_Find 1-10
|
||||||
|
Index_List_To_Tree 0-0
|
||||||
|
DS_Value_Find 1-10
|
||||||
|
DS_Check
|
||||||
|
DS_Close
|
||||||
|
Lib_Close
|
10
src/libnode/util/test-100K-s.ndb
Normal file
10
src/libnode/util/test-100K-s.ndb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Lib_Open 0
|
||||||
|
DS_Open 1
|
||||||
|
Index_List_Open 0-0
|
||||||
|
DS_Value_Add 1-100000 0
|
||||||
|
DS_Value_Find 49900-50100
|
||||||
|
Index_List_To_Tree 0-0
|
||||||
|
DS_Value_Find 1-100000
|
||||||
|
DS_Check
|
||||||
|
DS_Close
|
||||||
|
Lib_Close
|
10
src/libnode/util/test-100K.ndb
Normal file
10
src/libnode/util/test-100K.ndb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Lib_Open 0
|
||||||
|
DS_Open 0
|
||||||
|
Index_List_Open 0-0
|
||||||
|
DS_Value_Add 1-100000 0
|
||||||
|
DS_Value_Find 49900-50100
|
||||||
|
Index_List_To_Tree 0-0
|
||||||
|
DS_Value_Find 1-100000
|
||||||
|
DS_Check
|
||||||
|
DS_Close
|
||||||
|
Lib_Close
|
10
src/libnode/util/test-10K-s.ndb
Normal file
10
src/libnode/util/test-10K-s.ndb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Lib_Open 0
|
||||||
|
DS_Open 1
|
||||||
|
Index_List_Open 0-0
|
||||||
|
DS_Value_Add 1-10000 0
|
||||||
|
DS_Value_Find 4000-6000
|
||||||
|
Index_List_To_Tree 0-0
|
||||||
|
DS_Value_Find 1-10000
|
||||||
|
DS_Check
|
||||||
|
DS_Close
|
||||||
|
Lib_Close
|
10
src/libnode/util/test-10K.ndb
Normal file
10
src/libnode/util/test-10K.ndb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Lib_Open 0
|
||||||
|
DS_Open 0
|
||||||
|
Index_List_Open 0-0
|
||||||
|
DS_Value_Add 1-10000 0
|
||||||
|
DS_Value_Find 4000-6000
|
||||||
|
Index_List_To_Tree 0-0
|
||||||
|
DS_Value_Find 1-10000
|
||||||
|
DS_Check
|
||||||
|
DS_Close
|
||||||
|
Lib_Close
|
10
src/libnode/util/test-1M-s.ndb
Normal file
10
src/libnode/util/test-1M-s.ndb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Lib_Open 0
|
||||||
|
DS_Open 1
|
||||||
|
Index_List_Open 0-0
|
||||||
|
DS_Value_Add 1-1000000 0
|
||||||
|
DS_Value_Find 499990-500010
|
||||||
|
Index_List_To_Tree 0-0
|
||||||
|
DS_Value_Find 1-1000000
|
||||||
|
DS_Check
|
||||||
|
DS_Close
|
||||||
|
Lib_Close
|
10
src/libnode/util/test-1M.ndb
Normal file
10
src/libnode/util/test-1M.ndb
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Lib_Open 0
|
||||||
|
DS_Open 0
|
||||||
|
Index_List_Open 0-0
|
||||||
|
DS_Value_Add 1-1000000 0
|
||||||
|
DS_Value_Find 499990-500010
|
||||||
|
Index_List_To_Tree 0-0
|
||||||
|
DS_Value_Find 1-1000000
|
||||||
|
DS_Check
|
||||||
|
DS_Close
|
||||||
|
Lib_Close
|
9
src/libnode/util/test-all.ndb
Normal file
9
src/libnode/util/test-all.ndb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
Batch_Run test-error.ndb
|
||||||
|
Batch_Run test-10.ndb
|
||||||
|
Batch_Run test-10-s.ndb
|
||||||
|
Batch_Run test-10K.ndb
|
||||||
|
Batch_Run test-10K-s.ndb
|
||||||
|
Batch_Run test-100K.ndb
|
||||||
|
Batch_Run test-100K-s.ndb
|
||||||
|
Batch_Run test-1M.ndb
|
||||||
|
Batch_Run test-1M-s.ndb
|
15
src/libnode/util/test-error.ndb
Normal file
15
src/libnode/util/test-error.ndb
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
DS_Open 0
|
||||||
|
Lib_Open 0
|
||||||
|
DS_Open 0
|
||||||
|
Index_List_Open 0-0
|
||||||
|
DS_Value_Add 1-10 0
|
||||||
|
Lib_Close
|
||||||
|
Lib_Open 1
|
||||||
|
DS_Open 0
|
||||||
|
Index_List_Open 0-0
|
||||||
|
DS_Value_Add 1-10 0
|
||||||
|
Index_Value_Break 0-0 0
|
||||||
|
Index_Value_Break 0-0 1
|
||||||
|
Index_Value_Break 0-0 2
|
||||||
|
DS_Check
|
||||||
|
Lib_Close
|
420
src/libstatic_data_mng/include/static_data_mng.h
Normal file
420
src/libstatic_data_mng/include/static_data_mng.h
Normal file
@ -0,0 +1,420 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: static_data_mng.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _STATIC_DATA_MNG_H_
|
||||||
|
#define _STATIC_DATA_MNG_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <imr.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRD_API definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBSTATIC_DATA_MNG_C_
|
||||||
|
# define IMRD_SDM_API
|
||||||
|
# else
|
||||||
|
# define IMRD_SDM_API extern
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_SDM_Config */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef short IMRT_SDM_Flag;
|
||||||
|
|
||||||
|
#define IMRD_SDM_FLAG_UNKNOWN ( IMRT_SDM_Flag) 0
|
||||||
|
#define IMRD_SDM_FLAG_XML ( IMRT_SDM_Flag) 1
|
||||||
|
#define IMRD_SDM_FLAG_SQL ( IMRT_SDM_Flag) 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
IMRT_SDM_Flag Flag;
|
||||||
|
IMRT_Path Lib_Path;
|
||||||
|
} IMRT_SDM_Config;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_MsgMap_Id definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef int IMRT_MsgMap_Id;
|
||||||
|
|
||||||
|
#define IMRD_MSGMAP_ID_UNKNOWN ( IMRT_MsgMap_Id) 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_MsgMap definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct IMRT_MsgMap
|
||||||
|
{
|
||||||
|
IMRT_MsgMap_Id Id;
|
||||||
|
char Name[IMRD_NAME_SIZE];
|
||||||
|
IMRT_Msg *Msg_Input_Ptr;
|
||||||
|
IMRT_Msg *Msg_Output_Ptr;
|
||||||
|
NDT_Root *FieldMap_Struct_Ptr;
|
||||||
|
} IMRT_MsgMap;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_Jump definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef struct IMRT_Jump
|
||||||
|
{
|
||||||
|
IMRT_Fmt *Fmt_Ptr;
|
||||||
|
IMRT_Msg *Msg_Ptr;
|
||||||
|
int Branche_Id;
|
||||||
|
} IMRT_Jump;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMRT_MapCmd */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*#define IMRD_JUMP_NB_MAX ( short) 40*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_MapCmd_Id;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_MapCmd_Type;
|
||||||
|
|
||||||
|
#define IMRD_MAPCMD_TYPE_UNKNOWN ( IMRT_MapCmd_Type) 0
|
||||||
|
#define IMRD_MAPCMD_TYPE_MAP ( IMRT_MapCmd_Type) 1
|
||||||
|
#define IMRD_MAPCMD_TYPE_COPY ( IMRT_MapCmd_Type) 2
|
||||||
|
#define IMRD_MAPCMD_TYPE_IDENT ( IMRT_MapCmd_Type) 3
|
||||||
|
#define IMRD_MAPCMD_TYPE_GOTO ( IMRT_MapCmd_Type) 4
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_MapCmd_Branch_Id;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef short IMRT_MapCmd_Flag;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_MapCmd
|
||||||
|
{
|
||||||
|
IMRT_MapCmd_Id MapCmd_Id;
|
||||||
|
IMRT_MapCmd_Type TypeCmd;
|
||||||
|
IMRT_MapCmd_Branch_Id Branche_Id;
|
||||||
|
IMRT_Boolean Ident_Total;
|
||||||
|
IMRT_Msg *Ident_First_Msg_Ptr;
|
||||||
|
IMRT_Fmt *Fmt_Input_Ptr;
|
||||||
|
IMRT_FmtAttr *FmtAttr_Input_Ptr;
|
||||||
|
IMRT_Fmt *Fmt_Output_Ptr;
|
||||||
|
IMRT_FmtAttr *FmtAttr_Output_Ptr;
|
||||||
|
IMRT_Buffer_Id Buffer_Id_Input;
|
||||||
|
IMRT_Buffer_Id Buffer_Id_Output;
|
||||||
|
IMRT_Buffer_Id Buffer_Id_Ident;
|
||||||
|
IMRT_MapCmd_Flag Clear_Flag;
|
||||||
|
IMRT_MsgMap *MsgMap_Ptr;
|
||||||
|
IMRT_MapCmd_Branch_Id Goto_Branche_Id;
|
||||||
|
int JmpTbleNbElts;
|
||||||
|
IMRT_Jump *Jump_Tab;
|
||||||
|
} IMRT_MapCmd;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _LIBSTATIC_DATA_MNG_
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
extern IMRT_Module IMRG_SDM_Module;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Static Data Manager Client CallBack */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Format Add CallBack */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Fmt_Id: Format id */
|
||||||
|
/* (I) Fmt_Name: Format name */
|
||||||
|
/* (I) Fmt_Id_Nb: Total number of format */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef IMRT_Status IMRT_SDMCB_Fmt_Add( IMRT_Fmt_Id, IMRT_Fmt_Name, IMRT_Fmt_Id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Convert Add CallBack */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Cnv_Id: Convert id */
|
||||||
|
/* (I) Cnv_Name: Convert name */
|
||||||
|
/* (I) Cnv_Id_Nb: Total number of convert */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef IMRT_Status IMRT_SDMCB_Cnv_Add( IMRT_Cnv_Id, IMRT_Cnv_Name, IMRT_Cnv_Id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer Mapping CallBack */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Buffer_Id_Target: Target buffer id */
|
||||||
|
/* (I) Fmt_Target: Target format */
|
||||||
|
/* (I) Fmt_Attr_Target: Target format attribute */
|
||||||
|
/* (I) Buffer_Id_Src: Source buffer id */
|
||||||
|
/* (I) Fmt_Src: Source format */
|
||||||
|
/* (I) Fmt_Attr_Src: Source format attribute */
|
||||||
|
/* (I) MsgMap: Message Map to use */
|
||||||
|
/* (I) Clear_Flag: Clear or donn't clear output buffer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef IMRT_Status IMRT_SDMCB_Buffer_Map( IMRT_Buffer_Id, IMRT_Fmt_Id, IMRT_FmtAttr_Value, IMRT_Buffer_Id, IMRT_Fmt_Id, IMRT_FmtAttr_Value, IMRT_MsgMap *, IMRT_MapCmd_Flag);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer Copy CallBack */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Buffer_Id_Target: Target buffer id */
|
||||||
|
/* (I) Buffer_Id_Src: Source buffer id */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef IMRT_Status IMRT_SDMCB_Buffer_Copy( IMRT_Buffer_Id, IMRT_Buffer_Id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Buffer Identification CallBack */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (O) Fmt_Id_Ptr: Buffer format to return */
|
||||||
|
/* (I/O) Msg_Id_Ptr: Buffer message id to read (if not total) and return */
|
||||||
|
/* (I) Buffer_Id_Ptr: Id of the buffer to identify */
|
||||||
|
/* (I) Ident_Total: True if total identification */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef IMRT_Status IMRT_SDMCB_Buffer_Ident( IMRT_Fmt_Id *, IMRT_Msg_Id *, IMRT_Buffer_Id, IMRT_Boolean);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Field Mapping CallBack */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Field_Target_Ptr: Target Field pointer */
|
||||||
|
/* (I) Field_Source_Ptr: Source Field pointer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef IMRT_Status IMRT_SDMCB_Field_Map( IMRT_Field *, IMRT_Field *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Field Ident CallBack */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) FieldMap_Ptr: FielMap pointer */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
typedef IMRT_Status IMRT_SDMCB_Ident_Field_Value( IMRT_Field *, IMRT_Field_Value_Id);
|
||||||
|
|
||||||
|
|
||||||
|
typedef IMRT_Status IMRT_SDMCB_Ident_Field_Exist( IMRT_Field *);
|
||||||
|
|
||||||
|
|
||||||
|
typedef IMRT_Status IMRT_SDMCB_Ident_Msg_Size( size_t);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Static Data Manager API */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Open Static Data Manager */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Lib_Flag: Setup SDM init mode (XML, SQL, ...) */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_SDM_API IMRT_Status IMR_SDM_Library_Open( IMRT_SDM_Config *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Close Static Data Manager */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_SDM_API IMRT_Status IMR_SDM_Library_Close( void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Dump Data Structures to SQL files */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
IMRD_SDM_API IMRT_Status IMR_SDM_SQL_Dump(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Dump Data Structures to XML files */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
IMRD_SDM_API IMRT_Status IMR_SDM_XML_Dump(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Proceed Format */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) CCB_Fmt_Add_Ptr: Format add callback */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_SDM_API IMRT_Status IMR_SDM_Fmt_Proceed( IMRT_SDMCB_Fmt_Add *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Proceed Convert */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) CCB_Cnv_Add_Ptr: Convert add callback */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
IMRD_SDM_API IMRT_Status IMR_SDM_Cnv_Proceed( IMRT_SDMCB_Cnv_Add *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Proceed Convert */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) CCB_Cnv_Add_Ptr: Convert add callback */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_SDM_API IMRT_Status IMR_SDM_Cnv_Proceed( IMRT_SDMCB_Cnv_Add *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Proceed Mapping Path */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Appl_Id_Target: Target buffer application id */
|
||||||
|
/* (I) Fmt_Id_Target: Target buffer format id */
|
||||||
|
/* (I) Msg_Id_Target: Target buffer message id */
|
||||||
|
/* (I) ApplId_Src: Source buffer application id */
|
||||||
|
/* (I) Fmt_Id_Src: Source buffer format id */
|
||||||
|
/* (I) Msg_Id_Src: Source buffer message id */
|
||||||
|
/* (I) CCB_Buffer_Map_Ptr: Buffer mapping callback */
|
||||||
|
/* (I) CCB_Buffer_Copy_Ptr: Buffer copy callback */
|
||||||
|
/* (I) CCB_Buffer_Ident_Ptr: Buffer identification callback */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_SDM_API IMRT_Status IMR_SDM_MapPath_Proceed( IMRT_Appl_Id, IMRT_Fmt_Id, IMRT_Msg_Id,
|
||||||
|
IMRT_Appl_Id, IMRT_Fmt_Id, IMRT_Msg_Id,
|
||||||
|
IMRT_SDMCB_Buffer_Map *, IMRT_SDMCB_Buffer_Copy *, IMRT_SDMCB_Buffer_Ident *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Proceed Buffer Mapping */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) MsgMap_Ptr: Message map pointer */
|
||||||
|
/* (I) CCB_Field_Map_Ptr: Field mapping callback */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_SDM_API IMRT_Status IMR_SDM_MsgMap_Proceed( IMRT_MsgMap *, IMRT_SDMCB_Field_Map *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Proceed Message Identification */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* (I) Fmt_Id: Target buffer format id */
|
||||||
|
/* (I) Msg_Id: Target buffer message id */
|
||||||
|
/* (I) CCB_Field_Ident_Ptr: Field ident callback */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_SDM_API IMRT_Status IMR_SDM_MsgIdent_Proceed( IMRT_Fmt_Id, IMRT_Msg_Id *, IMRT_SDMCB_Ident_Field_Value *, IMRT_SDMCB_Ident_Field_Exist *, IMRT_SDMCB_Ident_Msg_Size *);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Convert Buffer Format Name to Buffer Format Id */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRD_SDM_API IMRT_Status IMR_SDM_Fmt_Id_Get( IMRT_Fmt_Id *, const IMRT_Fmt_Name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Convert Buffer Appli Name to Buffer Appli Id */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
IMRD_SDM_API IMRT_Status IMR_SDM_Appl_Id_Get( IMRT_Appl_Id *, const IMRT_Appl_Name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
79
src/libstatic_data_mng/src/Makefile
Normal file
79
src/libstatic_data_mng/src/Makefile
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Local Makefile
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Workfile: Makefile $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# $Author: agibert $
|
||||||
|
# $Date: 2008/11/12 02:25:23 $
|
||||||
|
# $Revision: 1.1 $
|
||||||
|
# $Label: $
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# IMR - Interlinking Message Router
|
||||||
|
# Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt)
|
||||||
|
# mailto:arnaud@rx3.net
|
||||||
|
# http://www.rx3.org/dvp/?dvp=imr
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# This file is part of IMR
|
||||||
|
#
|
||||||
|
# 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 2
|
||||||
|
# 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, write to the Free Software Foundation,
|
||||||
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Var include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include ../../Makefile_var.mk
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Variables
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
TARGET= libstatic_data_mng$(SHLIB_SUFFIX)
|
||||||
|
|
||||||
|
OBJ= libstatic_data_mng.o \
|
||||||
|
arc_hdl_xml.o \
|
||||||
|
buffer_info_mng.o \
|
||||||
|
mapping_info_mng.o \
|
||||||
|
struct_info_mng.o \
|
||||||
|
buffer_info_xml.o \
|
||||||
|
mapping_info_xml.o \
|
||||||
|
struct_info_xml.o
|
||||||
|
|
||||||
|
ifeq ($(ORACLE_SUPPORT),1)
|
||||||
|
OBJ+= arc_hdl_sql.o \
|
||||||
|
buffer_info_sql.o \
|
||||||
|
mapping_info_sql.o \
|
||||||
|
struct_info_sql.o
|
||||||
|
endif
|
||||||
|
|
||||||
|
EXTRA_INC=
|
||||||
|
|
||||||
|
EXTRA_LIB=
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# Rule include
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
include ../../Makefile_rule.mk
|
101
src/libstatic_data_mng/src/arc_hdl_sql.h
Normal file
101
src/libstatic_data_mng/src/arc_hdl_sql.h
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: arc_hdl_sql.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _ARC_HDL_SQL_H_
|
||||||
|
# define _ARC_HDL_SQL_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# include <libstatic_data_mng.h>
|
||||||
|
# include <sqlca.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global variables */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
# ifdef _ARC_HDL_SQL_PC_
|
||||||
|
|
||||||
|
typedef short IMRT_DB_Open_Flag;
|
||||||
|
|
||||||
|
#define IMRD_DB_OPEN_FLAG_UNKNOWN ( IMRT_DB_Open_Flag) 0
|
||||||
|
#define IMRD_DB_OPEN_FLAG_OPENED ( IMRT_DB_Open_Flag) 1
|
||||||
|
#define IMRD_DB_OPEN_FLAG_CLOSED ( IMRT_DB_Open_Flag) 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_SDM_SQL_Base
|
||||||
|
{
|
||||||
|
IMRT_DB_Open_Flag Open_Flag;
|
||||||
|
|
||||||
|
} IMRT_SDM_SQL_Base;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_SDM_SQL_Base IMRG_SDM_SQL_Base =
|
||||||
|
{
|
||||||
|
IMRD_DB_OPEN_FLAG_CLOSED
|
||||||
|
};
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _ARC_HDL_SQL_PC_
|
||||||
|
|
||||||
|
IMRT_Status SDM_HDR_SQL_Init(IMRT_SDM_Flag Flag);
|
||||||
|
IMRT_Status SDM_HDR_SQL_DInit(void);
|
||||||
|
IMRT_Status SDM_SQL_ConnectOra(void);
|
||||||
|
IMRT_Status SDM_SQL_DisconnectOra(void);
|
||||||
|
IMRT_Status SDM_SQL_Set_Struct_Version(IMRT_Data_Version *, char *);
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
extern IMRT_Status SDM_HDR_SQL_Init(IMRT_SDM_Flag Flag);
|
||||||
|
extern IMRT_Status SDM_HDR_SQL_DInit(void);
|
||||||
|
extern IMRT_Status SDM_SQL_ConnectOra(void);
|
||||||
|
extern IMRT_Status SDM_SQL_DisconnectOra(void);
|
||||||
|
extern IMRT_Status SDM_SQL_Set_Struct_Version(IMRT_Data_Version *, char *);
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
185
src/libstatic_data_mng/src/arc_hdl_sql.pc
Normal file
185
src/libstatic_data_mng/src/arc_hdl_sql.pc
Normal file
@ -0,0 +1,185 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: arc_hdl_sql.pc */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBSTATIC_DATA_MNG_
|
||||||
|
#define _ARC_HDL_SQL_PC_
|
||||||
|
|
||||||
|
#include "arc_hdl_sql.h"
|
||||||
|
|
||||||
|
|
||||||
|
IMRT_Status SDM_HDR_SQL_Init(IMRT_SDM_Flag Flag)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (Flag == IMRD_SDM_FLAG_SQL)
|
||||||
|
{
|
||||||
|
status = SDM_SQL_ConnectOra();
|
||||||
|
if (status == IMRS_OK)
|
||||||
|
{
|
||||||
|
IMRG_SDM_SQL_Base.Open_Flag = IMRD_DB_OPEN_FLAG_OPENED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return(status);
|
||||||
|
}
|
||||||
|
/******************************************************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
IMRT_Status SDM_HDR_SQL_DInit(void)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
if (IMRG_SDM_SQL_Base.Open_Flag == IMRD_DB_OPEN_FLAG_OPENED)
|
||||||
|
{
|
||||||
|
status = SDM_SQL_DisconnectOra();
|
||||||
|
}
|
||||||
|
|
||||||
|
return(status);
|
||||||
|
}
|
||||||
|
/******************************************************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
IMRT_Status SDM_SQL_ConnectOra(void)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
const char sFunctionName []="SDM_SQL_ConnectOra";
|
||||||
|
EXEC SQL BEGIN DECLARE SECTION;
|
||||||
|
VARCHAR vConnectString[50];
|
||||||
|
EXEC SQL END DECLARE SECTION;
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
strcpy ( (char *) vConnectString.arr, "/");
|
||||||
|
vConnectString.len = strlen( (char *) vConnectString.arr );
|
||||||
|
|
||||||
|
EXEC SQL CONNECT :vConnectString ;
|
||||||
|
if (sqlca.sqlcode != 0)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_3("Erreur %s. Erreur Oracle : %d - %s !", sFunctionName, sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(status);
|
||||||
|
}
|
||||||
|
/******************************************************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
IMRT_Status SDM_SQL_DisconnectOra(void)
|
||||||
|
{
|
||||||
|
IMRT_Status status;
|
||||||
|
const char sFunctionName []="SDM_SQL_DisconnectOra";
|
||||||
|
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
EXEC SQL COMMIT WORK RELEASE;
|
||||||
|
if (sqlca.sqlcode != 0)
|
||||||
|
{
|
||||||
|
IMRD_LM_LOG_ERROR_3("Erreur %s. Erreur Oracle : %d - %s !", sFunctionName, sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc);
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
|
||||||
|
return(status);
|
||||||
|
}
|
||||||
|
/******************************************************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
IMRT_Status SDM_SQL_Set_Struct_Version(IMRT_Data_Version *Data_Version_Ptr, char *Component_Ptr)
|
||||||
|
{
|
||||||
|
const char sFunctionName []="SDM_SQL_Get_Struct_Version";
|
||||||
|
IMRT_Status status;
|
||||||
|
|
||||||
|
EXEC SQL BEGIN DECLARE SECTION;
|
||||||
|
VARCHAR vVersName[IMRD_SDMD_VERS_NAME_LEN];
|
||||||
|
VARCHAR vVersLabel[IMRD_SDMD_VERS_LABEL_LEN];
|
||||||
|
VARCHAR vVersDate[IMRD_SDMD_VERS_DATE_LEN];
|
||||||
|
|
||||||
|
short hIndVersName;
|
||||||
|
short hIndVersLabel;
|
||||||
|
short hIndVersDate;
|
||||||
|
EXEC SQL END DECLARE SECTION;
|
||||||
|
|
||||||
|
|
||||||
|
/* initialisation */
|
||||||
|
status = IMRS_OK;
|
||||||
|
|
||||||
|
strcpy((char*) vVersName.arr, Component_Ptr);
|
||||||
|
vVersName.len = strlen((char*) vVersName.arr );
|
||||||
|
|
||||||
|
memset(vVersLabel.arr, '\0', (size_t) IMRD_SDMD_VERS_LABEL_LEN);
|
||||||
|
memset(vVersDate.arr, '\0', (size_t) IMRD_SDMD_VERS_DATE_LEN);
|
||||||
|
|
||||||
|
EXEC SQL DECLARE cur_imr_version CURSOR FOR
|
||||||
|
SELECT VERS_LABEL, VERS_DATE
|
||||||
|
FROM IMR_DATA_VERSION
|
||||||
|
WHERE VERS_NAME = :vVersName;
|
||||||
|
|
||||||
|
EXEC SQL OPEN cur_imr_version;
|
||||||
|
|
||||||
|
EXEC SQL FETCH cur_imr_version
|
||||||
|
INTO :vVersLabel:hIndVersLabel,
|
||||||
|
:vVersDate:hIndVersDate;
|
||||||
|
|
||||||
|
if (sqlca.sqlcode == 0)
|
||||||
|
{
|
||||||
|
if (hIndVersLabel >= 0)
|
||||||
|
{
|
||||||
|
strcpy(Data_Version_Ptr->Label, (char*)vVersLabel.arr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Data_Version_Ptr->Label[0] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hIndVersDate >= 0)
|
||||||
|
{
|
||||||
|
strcpy(Data_Version_Ptr->Date, (char*)vVersDate.arr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Data_Version_Ptr->Date[0] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
status = IMRS_KO;
|
||||||
|
}
|
||||||
|
|
||||||
|
EXEC SQL CLOSE cur_imr_version;
|
||||||
|
|
||||||
|
return(status);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
76
src/libstatic_data_mng/src/arc_hdl_xml.c
Normal file
76
src/libstatic_data_mng/src/arc_hdl_xml.c
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: arc_hdl_xml.c */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#define _LIBSTATIC_DATA_MNG_
|
||||||
|
#define _ARC_HDL_XML_C_
|
||||||
|
|
||||||
|
#include "arc_hdl_xml.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*Raise Error */
|
||||||
|
/*ctx : contexte avec lequele la fonction est appelée */
|
||||||
|
/*functionname : nom de la focntion qui léve l'erreur */
|
||||||
|
/*lib_error : libellé de l'erreur */
|
||||||
|
/*code : code de l'erreur */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
IMRT_Status SDM_HDR_XML_Init(IMRT_SDM_Flag Flag)
|
||||||
|
{
|
||||||
|
|
||||||
|
return(IMRS_OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
IMRT_Status SDM_HDR_XML_DInit(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
return(IMRS_OK);
|
||||||
|
|
||||||
|
}
|
||||||
|
/******************************************************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
/******************************************************************************/
|
||||||
|
void SDM_RaiseError(xmlParserCtxt * Ctx_Sax_Ptr, IMRT_Error * Struct_Error_Ptr ,IMRT_Status * Flag_Error ,
|
||||||
|
const char* functionname, const char* lib_error, const int code )
|
||||||
|
{
|
||||||
|
|
||||||
|
fprintf(stderr,"\nRaise error <%s>",lib_error);
|
||||||
|
Ctx_Sax_Ptr->sax = &ErrorSAXHandlerStruct;
|
||||||
|
*Flag_Error = IMRS_KO;
|
||||||
|
Struct_Error_Ptr->errorCode = code;
|
||||||
|
strcpy(Struct_Error_Ptr->libError,lib_error) ;
|
||||||
|
strcpy(Struct_Error_Ptr->function,functionname);
|
||||||
|
}
|
113
src/libstatic_data_mng/src/arc_hdl_xml.h
Normal file
113
src/libstatic_data_mng/src/arc_hdl_xml.h
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: arc_hdl_xml.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _ARC_HDL_XML_H_
|
||||||
|
# define _ARC_HDL_XML_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# include <libstatic_data_mng.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# ifdef _ARC_HDL_XML_C_
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
/*Globale Variable */
|
||||||
|
/*-----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
xmlSAXHandler ErrorSAXHandlerStruct = {
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
1,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
# else
|
||||||
|
extern xmlSAXHandler ErrorSAXHandlerStruct;
|
||||||
|
|
||||||
|
# endif
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _ARC_HDL_XML_C_
|
||||||
|
|
||||||
|
IMRT_Status SDM_HDR_XML_Init(IMRT_SDM_Flag Flag);
|
||||||
|
IMRT_Status SDM_HDR_XML_DInit(void);
|
||||||
|
void SDM_RaiseError(xmlParserCtxt * Ctx_Sax_Ptr, IMRT_Error * Struct_Erro_Ptr ,IMRT_Status * Flag_Error ,
|
||||||
|
const char* functionname, const char* lib_error, const int code );
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
extern IMRT_Status SDM_HDR_XML_Init(IMRT_SDM_Flag Flag);
|
||||||
|
extern IMRT_Status SDM_HDR_XML_DInit(void);
|
||||||
|
extern void SDM_RaiseError(xmlParserCtxt * Ctx_Sax_Ptr, IMRT_Error * Struct_Erro_Ptr ,IMRT_Status * Flag_Error ,
|
||||||
|
const char* functionname, const char* lib_error, const int code );
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
2909
src/libstatic_data_mng/src/buffer_info_mng.c
Normal file
2909
src/libstatic_data_mng/src/buffer_info_mng.c
Normal file
File diff suppressed because it is too large
Load Diff
258
src/libstatic_data_mng/src/buffer_info_mng.h
Normal file
258
src/libstatic_data_mng/src/buffer_info_mng.h
Normal file
@ -0,0 +1,258 @@
|
|||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* File: buffer_info_mng.h */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* IMR - Interlinking Message Router */
|
||||||
|
/* Copyright (C) 2005 Arnaud G. Gibert & Others (See ReadMe.txt) */
|
||||||
|
/* mailto:arnaud@rx3.net */
|
||||||
|
/* http://www.rx3.org/dvp/?dvp=imr */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* This file is part of IMR */
|
||||||
|
/* */
|
||||||
|
/* 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 2 */
|
||||||
|
/* 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, write to the Free Software Foundation, */
|
||||||
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef _BUFFER_INFO_MNG_H_
|
||||||
|
# define _BUFFER_INFO_MNG_H_
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Global Include */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# include <libstatic_data_mng.h>
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local definition */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* XML TAG */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
#define IMRD_SDMD_FMTATTR_STRUCT "fmtattr_struct"
|
||||||
|
#define IMRD_SDMD_APPLI_STRUCT "appl_struct"
|
||||||
|
#define IMRD_SDMD_FMT_STRUCT "fmt_struct"
|
||||||
|
#define IMRD_SDMD_MAPPATH_STRUCT "mappath_struct"
|
||||||
|
|
||||||
|
/* Nom des fichiers pour le chargement XML */
|
||||||
|
#define SDMD_FMTATTR_FILE "sd_fmtattr_struct.xml"
|
||||||
|
#define SDMD_APPLI_FILE "sd_appl_struct.xml"
|
||||||
|
#define SDMD_FORMAT_FILE "sd_fmt_struct.xml"
|
||||||
|
#define SDMD_MAPPATH_FILE "sd_mappath_struct.xml"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define SDMD_CRI_IA 0 /*Critére input appli*/
|
||||||
|
#define SDMD_CRI_OA 1 /*Critére output appli*/
|
||||||
|
#define SDMD_CRI_IF 2 /*Critére input format*/
|
||||||
|
#define SDMD_CRI_OF 3 /*Critére output format*/
|
||||||
|
#define SDMD_CRI_IT 4 /*Critére input type*/
|
||||||
|
#define SDMD_CRI_OT 5 /*Critére ouput type*/
|
||||||
|
|
||||||
|
#define SDMD_NB_CRITERE_CHEMIN 4
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct IMRT_Appl
|
||||||
|
{
|
||||||
|
IMRT_Appl_Id Id;
|
||||||
|
IMRT_Appl_Name Name ;
|
||||||
|
|
||||||
|
} IMRT_Appl;
|
||||||
|
|
||||||
|
typedef struct IMRT_MapPath
|
||||||
|
{
|
||||||
|
int idMapPath;
|
||||||
|
IMRT_Fmt * Fmt_Input_Ptr;
|
||||||
|
IMRT_Fmt * Fmt_Output_Ptr;
|
||||||
|
IMRT_Appl * Appl_Input_Ptr;
|
||||||
|
IMRT_Appl * Appl_Output_Ptr;
|
||||||
|
NDT_Root * MapCmd_Struct_Ptr;
|
||||||
|
} IMRT_MapPath;
|
||||||
|
|
||||||
|
|
||||||
|
/*typedef struct SDMT_FmtMsg
|
||||||
|
{
|
||||||
|
char name [IMRD_NAME_LEN];
|
||||||
|
IMRT_Msg * msg;
|
||||||
|
|
||||||
|
} SDMT_FmtMsg;
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct SDMT_CritereRecChemin
|
||||||
|
{
|
||||||
|
IMRT_Appl_Id InputAppli;
|
||||||
|
IMRT_Appl_Id OutputAppli;
|
||||||
|
IMRT_Fmt_Id InputFormat;
|
||||||
|
IMRT_Fmt_Id OutputFormat;
|
||||||
|
IMRT_Msg_Id InputType;
|
||||||
|
IMRT_Msg_Id OutputType;
|
||||||
|
int Branche_id;
|
||||||
|
IMRT_Error FataError;
|
||||||
|
IMRT_SDMCB_Buffer_Ident * CallBackCommandeIdent;
|
||||||
|
IMRT_SDMCB_Buffer_Map * CallBackBCommandeMap;
|
||||||
|
IMRT_SDMCB_Buffer_Copy * CallBackCommandeCopy;
|
||||||
|
|
||||||
|
} SDMT_CritereRecChemin;
|
||||||
|
|
||||||
|
/********************************************************************/
|
||||||
|
/* Les index du Manager SDM_Appl_Manager */
|
||||||
|
/********************************************************************/
|
||||||
|
#define IMRD_SDMD_APPL_STRUCT_IDX_NB (short)2
|
||||||
|
|
||||||
|
static NDT_Index_Type Appl_Struct_initial_idx_tab[IMRD_SDMD_APPL_STRUCT_IDX_NB] =
|
||||||
|
{
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_SORTED),
|
||||||
|
(NDD_INDEX_STATUS_CLOSED)
|
||||||
|
};
|
||||||
|
|
||||||
|
static NDT_Index_Type Appl_Struct_final_idx_tab[IMRD_SDMD_APPL_STRUCT_IDX_NB] =
|
||||||
|
{
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_TREE | NDD_INDEX_SUBTYPE_BALANCED),
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_TREE | NDD_INDEX_SUBTYPE_BALANCED)
|
||||||
|
};
|
||||||
|
|
||||||
|
#define IMRD_SDMD_APPL_IDX_ID (short)0
|
||||||
|
#define IMRD_SDMD_APPL_IDX_NAME (short)1
|
||||||
|
|
||||||
|
/********************************************************************/
|
||||||
|
/* Les index du Manager SDM_FmtAttr_Manager */
|
||||||
|
/********************************************************************/
|
||||||
|
#define IMRD_SDMD_FMTATTR_STRUCT_IDX_NB (short)2
|
||||||
|
|
||||||
|
static NDT_Index_Type FmtAttr_Struct_initial_idx_tab[IMRD_SDMD_FMTATTR_STRUCT_IDX_NB] =
|
||||||
|
{
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_SORTED),
|
||||||
|
(NDD_INDEX_STATUS_CLOSED)
|
||||||
|
};
|
||||||
|
|
||||||
|
static NDT_Index_Type FmtAttr_Struct_final_idx_tab[IMRD_SDMD_FMTATTR_STRUCT_IDX_NB] =
|
||||||
|
{
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_TREE | NDD_INDEX_SUBTYPE_BALANCED),
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_TREE | NDD_INDEX_SUBTYPE_BALANCED)
|
||||||
|
};
|
||||||
|
|
||||||
|
#define IMRD_SDMD_FMTATTR_IDX_ID (short)0
|
||||||
|
#define IMRD_SDMD_FMTATTR_IDX_NAME (short)1
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************************/
|
||||||
|
/* Les index du Manager SDM_Fmt_Manager */
|
||||||
|
/********************************************************************/
|
||||||
|
#define IMRD_SDMD_FMT_STRUCT_IDX_NB (short)2
|
||||||
|
|
||||||
|
static NDT_Index_Type Fmt_Struct_initial_idx_tab[IMRD_SDMD_FMT_STRUCT_IDX_NB] =
|
||||||
|
{
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_LIST | NDD_INDEX_SUBTYPE_SORTED),
|
||||||
|
(NDD_INDEX_STATUS_CLOSED)
|
||||||
|
};
|
||||||
|
|
||||||
|
static NDT_Index_Type Fmt_Struct_final_idx_tab[IMRD_SDMD_FMT_STRUCT_IDX_NB] =
|
||||||
|
{
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_TREE | NDD_INDEX_SUBTYPE_BALANCED),
|
||||||
|
(NDD_INDEX_STATUS_OPENED | NDD_INDEX_TYPE_TREE | NDD_INDEX_SUBTYPE_BALANCED)
|
||||||
|
};
|
||||||
|
|
||||||
|
#define IMRD_SDMD_FMT_IDX_ID (short)0
|
||||||
|
#define IMRD_SDMD_FMT_IDX_NAME (short)1
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Prototypes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _BUFFER_INFO_MNG_C_
|
||||||
|
IMRT_Status SDM_DataStruct_Finalize(NDT_Root *, NDT_Index_Type *, short );
|
||||||
|
NDT_Status SDM_Appl_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
NDT_Status SDM_FmtAttr_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
NDT_Status SDM_FmtMsg_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
NDT_Status SDM_Fmt_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
NDT_Status SDM_MapCmd_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
NDT_Status SDM_MapPath_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
IMRT_Status SDM_MapPath_Proceed( IMRT_Appl_Id Appl_Id_Target, IMRT_Fmt_Id Fmt_Id_Target, IMRT_Msg_Id Msg_Id_Target,
|
||||||
|
IMRT_Appl_Id ApplId_Src, IMRT_Fmt_Id Fmt_Id_Src, IMRT_Msg_Id Msg_Id_Src,
|
||||||
|
IMRT_SDMCB_Buffer_Map *CCB_Buffer_Map_Ptr,
|
||||||
|
IMRT_SDMCB_Buffer_Copy *CCB_Buffer_Copy_Ptr,
|
||||||
|
IMRT_SDMCB_Buffer_Ident *CCB_Buffer_Ident_Ptr);
|
||||||
|
IMRT_Status SDM_Fmt_Proceed( IMRT_SDMCB_Fmt_Add *CCB_Fmt_Add_Ptr);
|
||||||
|
void SDM_CompareCritereMapPath(IMRT_Status CitereTable[],
|
||||||
|
const int NbCritere,
|
||||||
|
SDMT_CritereRecChemin * Critere,
|
||||||
|
IMRT_MapPath * myMapPath,
|
||||||
|
IMRT_Status *Valide );
|
||||||
|
void SDM_IniTableCritere(IMRT_Status Table[],const int NbElement);
|
||||||
|
void SDM_InitMapCmd(IMRT_MapCmd * mymapcmd);
|
||||||
|
void SDM_InitMapPath(IMRT_MapPath * mymappath);
|
||||||
|
void SDM_InitFormat(IMRT_Fmt * myformat);
|
||||||
|
void SDM_InitFmtAttr(IMRT_FmtAttr * myFmtAttr);
|
||||||
|
void SDM_InitFmtMsg(IMRT_FmtMsg * myFmtMsg);
|
||||||
|
void SDM_InitAppl(IMRT_Appl * Appl_Ptr);
|
||||||
|
IMRT_Status SDM_BufferInfo_Init(IMRT_SDM_Config * Lib_Config_Ptr);
|
||||||
|
IMRT_Status SDM_Close_RootMapPath(void);
|
||||||
|
IMRT_Status SDM_Close_RootAppl(void);
|
||||||
|
IMRT_Status SDM_Close_RootFmtAttr(void);
|
||||||
|
IMRT_Status SDM_Close_RootFmt(void);
|
||||||
|
IMRT_Status SDM_BufferInfo_DInit(void);
|
||||||
|
|
||||||
|
# else
|
||||||
|
|
||||||
|
extern IMRT_Status SDM_DataStruct_Finalize(NDT_Root *ds_Ptr, NDT_Index_Type *Index_Id_Ptr, short hMaxEntries);
|
||||||
|
extern NDT_Status SDM_Appl_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
extern NDT_Status SDM_FmtAttr_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
extern NDT_Status SDM_FmtMsg_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
extern NDT_Status SDM_Fmt_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
extern NDT_Status SDM_MapCmd_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
extern NDT_Status SDM_MapPath_Manager( NDT_Root *, NDT_Index_Id, NDT_Node *, NDT_Command, va_list);
|
||||||
|
extern IMRT_Status SDM_MapPath_Proceed( IMRT_Appl_Id Appl_Id_Target, IMRT_Fmt_Id Fmt_Id_Target, IMRT_Msg_Id Msg_Id_Target,
|
||||||
|
IMRT_Appl_Id ApplId_Src, IMRT_Fmt_Id Fmt_Id_Src, IMRT_Msg_Id Msg_Id_Src,
|
||||||
|
IMRT_SDMCB_Buffer_Map *CCB_Buffer_Map_Ptr,
|
||||||
|
IMRT_SDMCB_Buffer_Copy *CCB_Buffer_Copy_Ptr,
|
||||||
|
IMRT_SDMCB_Buffer_Ident *CCB_Buffer_Ident_Ptr);
|
||||||
|
extern IMRT_Status SDM_Fmt_Proceed( IMRT_SDMCB_Fmt_Add *CCB_Fmt_Add_Ptr);
|
||||||
|
extern IMRT_Status SDM_BufferInfo_Init(IMRT_SDM_Config * Lib_Config_Ptr);
|
||||||
|
extern IMRT_Status SDM_Close_RootMapPath(void);
|
||||||
|
extern IMRT_Status SDM_Close_RootAppl(void);
|
||||||
|
extern IMRT_Status SDM_Close_RootFmtAttr(void);
|
||||||
|
extern IMRT_Status SDM_Close_RootFmt(void);
|
||||||
|
extern IMRT_Status SDM_BufferInfo_DInit(void);
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
/* Local Includes */
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
# ifdef _BUFFER_INFO_MNG_C_
|
||||||
|
|
||||||
|
# include "buffer_info_xml.h"
|
||||||
|
# include "buffer_info_sql.h"
|
||||||
|
|
||||||
|
# endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*----------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user