mirror of
https://github.com/LCPQ/quantum_package
synced 2024-11-04 13:13:57 +01:00
f77 folder
This commit is contained in:
parent
c70eeda9bb
commit
1649b47a59
29
f77_zmq/.gitignore
vendored
Normal file
29
f77_zmq/.gitignore
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
# Object files
|
||||
*.o
|
||||
*.ko
|
||||
*.obj
|
||||
*.elf
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Libraries
|
||||
*.lib
|
||||
*.a
|
||||
*.la
|
||||
*.lo
|
||||
|
||||
# Shared objects (inc. Windows DLLs)
|
||||
*.dll
|
||||
*.so
|
||||
*.so.*
|
||||
*.dylib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
*.i*86
|
||||
*.x86_64
|
||||
*.hex
|
495
f77_zmq/LICENSE
Normal file
495
f77_zmq/LICENSE
Normal file
@ -0,0 +1,495 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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.
|
||||
|
||||
f77_zmq : Fortran 77 bindings for the ZeroMQ library
|
||||
Copyright (C) 2014 Anthony Scemama
|
||||
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
USA
|
||||
|
||||
Anthony Scemama <scemama@irsamc.ups-tlse.fr>
|
||||
Laboratoire de Chimie et Physique Quantiques - UMR5626
|
||||
Université Paul Sabatier - Bat. 3R1b4, 118 route de Narbonne
|
||||
31062 Toulouse Cedex 09, France
|
32
f77_zmq/Makefile
Normal file
32
f77_zmq/Makefile
Normal file
@ -0,0 +1,32 @@
|
||||
# ZeroMQ header file
|
||||
|
||||
ifndef ZMQ_H
|
||||
$(error Please set the ZMQ_H environment variable to the full path of zmq.h)
|
||||
endif
|
||||
|
||||
CC=gcc
|
||||
#CFLAGS=-O3 -fPIC -Wall -pedantic -g
|
||||
CFLAGS=-O3 -fPIC -g
|
||||
|
||||
.PHONY: default
|
||||
|
||||
default: libf77zmq.so libf77zmq.a f77_zmq.h
|
||||
|
||||
libf77zmq.so: f77_zmq.o
|
||||
$(CC) -shared $^ -o $@
|
||||
|
||||
libf77zmq.a: f77_zmq.o
|
||||
$(AR) cr $@ $^
|
||||
|
||||
zmq.h: $(ZMQ_H)
|
||||
cp $(ZMQ_H) .
|
||||
|
||||
f77_zmq.o: f77_zmq.c
|
||||
$(CC) $(CFLAGS) -c $^ -o $@
|
||||
|
||||
f77_zmq.h: create_f77_zmq_h.py zmq.h f77_zmq.c
|
||||
python create_f77_zmq_h.py zmq.h
|
||||
|
||||
clean:
|
||||
$(RM) -f -- f77_zmq.o f77_zmq.h
|
||||
$(MAKE) -C examples clean
|
125
f77_zmq/README.md
Normal file
125
f77_zmq/README.md
Normal file
@ -0,0 +1,125 @@
|
||||
# F77\_ZMQ
|
||||
|
||||
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/scemama/f77_zmq?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
A Fortran 77 binding library for [ZeroMQ](http://zeromq.org)
|
||||
|
||||
## Usage
|
||||
|
||||
Copy the `f77_zmq.h` and `libf77zmq.so` or `libf77zmq.a` files into
|
||||
your project.
|
||||
|
||||
In your Fortran source files, include the `f77_zmq.h` file. This will define all the `ZMQ_*` constants.
|
||||
All the pointers (to sockets, messages, polling items, etc) are defined as `integer(ZMQ_PTR)`
|
||||
in order to handle 32-bit or 64-bit pointers.
|
||||
|
||||
In your Makefile, compile as follows:
|
||||
|
||||
```
|
||||
$(FC) -o $(TARGET) $(OBJ) -lzmq -lf77zmq
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```
|
||||
$(FC) -o $(TARGET) $(OBJ) -lzmq libf77zmq.a
|
||||
```
|
||||
|
||||
Be sure that `libzmq.so.4` is present in your `LD_LIBRARY_PATH` before executing the program.
|
||||
|
||||
|
||||
|
||||
## Installation instructions
|
||||
|
||||
|
||||
Python >= 2.6 is required to create the `f77_zmq.h` file.
|
||||
|
||||
Set the `ZMQ_H` environment variable to the absolute path of the zmq.h file, and run make.
|
||||
The default compiler is gcc.
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
$ export ZMQ_H=/usr/include/zmq.h
|
||||
$ make
|
||||
```
|
||||
|
||||
## Differences with the C API
|
||||
|
||||
In Fortran77 structs don't exist. They have been introduced with Fortran90.
|
||||
To maintain F77 compatibility, the structs are created using C functions
|
||||
and their pointers are passed to the Fortan. This implies the addition
|
||||
of a few functions.
|
||||
|
||||
### Additional Message-related functions
|
||||
|
||||
* `integer(ZMQ_PTR) f77_zmq_msg_new()` : Allocates a `zmq_msg_t` and returns the pointer
|
||||
|
||||
* `integer f77_zmq_msg_destroy(msg)` : Deallocates the `zmq_msg_t`. Return value is `0`.
|
||||
|
||||
+ `integer(ZMQ_PTR) msg` : message
|
||||
|
||||
* `integer(ZMQ_PTR) f77_zmq_msg_data_new(size, buffer, size_buffer)` : Allocates a data
|
||||
buffer for messages, and copies the buffer into the data segment. If `size_buffer` is `0`,
|
||||
the data segement is uninitialized. The return value is a pointer to the data segment.
|
||||
|
||||
+ `integer size` : Size of the data segment to allocate
|
||||
+ `buffer` : Buffer to copy. Fortran array or string.
|
||||
+ `integer size_buffer` : Number of bytes to copy from the buffer
|
||||
|
||||
* `integer f77_zmq_msg_destroy_data(data)` : Deallocates a data segment. Return value is `0`.
|
||||
|
||||
+ `integer(ZMQ_PTR) data` : pointer to the data segment to deallocate.
|
||||
|
||||
* `integer f77_zmq_msg_copy_from_data(msg, buffer)` : Copies the data segment of a message
|
||||
into a buffer.
|
||||
|
||||
+ `integer(ZMQ_PTR) msg` : message
|
||||
+ `buffer` : fortran array of string
|
||||
|
||||
* `integer f77_zmq_msg_copy_to_data(msg, buffer, size)` : Copies the data segment of a message
|
||||
into a buffer.
|
||||
|
||||
+ `integer(ZMQ_PTR) msg` : message
|
||||
+ `buffer` : fortran array of string
|
||||
+ `integer size` : Number of bytes to copy
|
||||
|
||||
|
||||
### Additional Polling-related functions
|
||||
|
||||
* `integer(ZMQ_PTR) f77_zmq_pollitem_new()` : Allocates a `zmq_pollitem_t` and returns the pointer
|
||||
|
||||
* `integer f77_zmq_pollitem_destroy(item)` : Deallocates the `zmq_pollitem_t`. Return value is `0`.
|
||||
|
||||
+ `integer(ZMQ_PTR) item` : poll item struct
|
||||
|
||||
|
||||
### Additional Event-related functions
|
||||
|
||||
* `integer(ZMQ_PTR) f77_zmq_event_new()` : Allocates a `zmq_event_t` and returns the pointer
|
||||
|
||||
* `integer f77_zmq_event_destroy(event)` : Deallocates the `zmq_event_t`. Return value is `0`.
|
||||
|
||||
+ `integer(ZMQ_PTR) event` : event struct
|
||||
|
||||
* `int f77_zmq_event_event(event)` : Returns the event field of the `zmq_event_t`.
|
||||
|
||||
+ `integer(ZMQ_PTR) event` : `zmq_event_t` struct
|
||||
|
||||
* `int f77_zmq_event_set_event(event, bitfield) : Sets the event field of the `zmq_event_t`.
|
||||
Returns `0`.
|
||||
|
||||
+ `integer(ZMQ_PTR) event` : `zmq_event_t` struct
|
||||
+ `integer bitfield` : id of the event as bitfield
|
||||
|
||||
* `int f77_zmq_event_value(event)` : Returns the value field of the `zmq_event_t`.
|
||||
|
||||
+ `integer(ZMQ_PTR) event` : `zmq_event_t` struct
|
||||
|
||||
* `int f77_zmq_event_set_value(event, value) : Sets the value field of the `zmq_event_t`.
|
||||
Returns `0`.
|
||||
|
||||
+ `integer(ZMQ_PTR) event` : `zmq_event_t` struct
|
||||
+ `integer value` : value is either error code, fd or reconnect interval
|
||||
|
||||
|
129
f77_zmq/create_f77_zmq_h.py
Executable file
129
f77_zmq/create_f77_zmq_h.py
Executable file
@ -0,0 +1,129 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# f77_zmq : Fortran 77 bindings for the ZeroMQ library
|
||||
# Copyright (C) 2014 Anthony Scemama
|
||||
#
|
||||
#
|
||||
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
# USA
|
||||
#
|
||||
# Anthony Scemama <scemama@irsamc.ups-tlse.fr>
|
||||
# Laboratoire de Chimie et Physique Quantiques - UMR5626
|
||||
# Universite Paul Sabatier - Bat. 3R1b4, 118 route de Narbonne
|
||||
# 31062 Toulouse Cedex 09, France
|
||||
|
||||
|
||||
|
||||
import sys
|
||||
import ctypes
|
||||
|
||||
# The first argument is the location of the ZeroMQ source directory
|
||||
|
||||
if len(sys.argv) != 2:
|
||||
print "usage: %s zmq.h"
|
||||
sys.exit(1)
|
||||
|
||||
ZMQ_H = sys.argv[1]
|
||||
|
||||
def create_lines(f):
|
||||
result = f.read()
|
||||
result = result.replace('\\\n', '')
|
||||
result = result.split('\n')
|
||||
return result
|
||||
|
||||
def create_dict_of_defines(lines,file_out):
|
||||
"""lines is a list of lines coming from the zmq.h"""
|
||||
# Fetch all parameters in zmq.h
|
||||
d = {}
|
||||
for line in lines:
|
||||
if line.startswith("#define"):
|
||||
buffer = line.split()
|
||||
key = buffer[1]
|
||||
value = " ".join(buffer[2:])
|
||||
if key[0] == '_' or '(' in key or ',' in value:
|
||||
continue
|
||||
command = "%(key)s=%(value)s\nd['%(key)s']=%(key)s"%locals()
|
||||
exec command in locals()
|
||||
|
||||
# Add the version number:
|
||||
d['ZMQ_VERSION'] = ZMQ_VERSION_MAJOR*10000 + ZMQ_VERSION_MINOR*100 + ZMQ_VERSION_PATCH
|
||||
d['ZMQ_PTR'] = ctypes.sizeof(ctypes.c_voidp)
|
||||
print "==========================================="
|
||||
print "ZMQ_PTR set to %d (for %d-bit architectures)"%(d['ZMQ_PTR'],d['ZMQ_PTR']*8)
|
||||
print "==========================================="
|
||||
|
||||
# Print to file
|
||||
keys = list( d.keys() )
|
||||
keys.sort()
|
||||
for k in keys:
|
||||
print >>file_out, " integer %s"%(k)
|
||||
for k in keys:
|
||||
print >>file_out, " parameter ( %-20s = %s )"%(k, d[k])
|
||||
return None
|
||||
|
||||
def create_prototypes(lines,file_out):
|
||||
"""lines is a list of lines coming from the f77_zmq.c file"""
|
||||
typ_conv = {
|
||||
'int' : 'integer' ,
|
||||
'float' : 'real',
|
||||
'char*' : 'character*(256)',
|
||||
'double' : 'double precision',
|
||||
'void*' : 'integer*%d'%(ctypes.sizeof(ctypes.c_voidp)),
|
||||
'void' : None
|
||||
}
|
||||
# Get all the functions of the f77_zmq.c file
|
||||
d = {}
|
||||
for line in lines:
|
||||
if line == "":
|
||||
continue
|
||||
if line[0] in " #{}/":
|
||||
continue
|
||||
buffer = line.replace('_(','_ (').lower().split()
|
||||
typ = typ_conv[buffer[0]]
|
||||
if typ is None:
|
||||
continue
|
||||
name = buffer[1][:-1]
|
||||
d[name] = typ
|
||||
|
||||
# Print to file
|
||||
keys = list( d.keys() )
|
||||
keys.sort()
|
||||
for k in keys:
|
||||
print >>file_out, " %-20s %s"%(d[k],k)
|
||||
print >>file_out, " %-20s %s"%("external",k)
|
||||
return None
|
||||
|
||||
|
||||
|
||||
def main():
|
||||
file_out = open('f77_zmq.h','w')
|
||||
|
||||
file_in = open( ZMQ_H, 'r' )
|
||||
lines = create_lines(file_in)
|
||||
file_in.close()
|
||||
|
||||
create_dict_of_defines(lines,file_out)
|
||||
|
||||
file_in = open( 'f77_zmq.c', 'r' )
|
||||
lines = create_lines(file_in)
|
||||
file_in.close()
|
||||
|
||||
create_prototypes(lines,file_out)
|
||||
|
||||
file_out.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
23
f77_zmq/examples/Makefile
Normal file
23
f77_zmq/examples/Makefile
Normal file
@ -0,0 +1,23 @@
|
||||
FC=ifort -O2 -xHost -openmp
|
||||
#FC=gfortran -g -O2 -Wall -Wno-unused -fopenmp
|
||||
LIBS=-lzmq libf77zmq.a
|
||||
|
||||
EXE=hwserver hwclient wuserver wuclient ventserver ventclient\
|
||||
hwserver_msg hwclient_msg socket_monitor dummy_cipsi
|
||||
|
||||
.PHONY: default
|
||||
|
||||
default: $(EXE)
|
||||
|
||||
%: %.f f77_zmq.h libf77zmq.a
|
||||
$(FC) $*.f -o $@ $(LIBS)
|
||||
|
||||
libf77zmq.a: ../libf77zmq.a
|
||||
$(MAKE) -C ..
|
||||
cp ../libf77zmq.a .
|
||||
|
||||
f77_zmq.h: ../f77_zmq.h
|
||||
cp ../f77_zmq.h .
|
||||
|
||||
clean:
|
||||
$(RM) -f -- $(EXE) f77_zmq.o f77_zmq.h *.ipc
|
41
f77_zmq/examples/TODO.md
Normal file
41
f77_zmq/examples/TODO.md
Normal file
@ -0,0 +1,41 @@
|
||||
# Creating a shared queue proxy
|
||||
|
||||
```
|
||||
// Create frontend and backend sockets
|
||||
void *frontend = zmq_socket (context, ZMQ_ROUTER);
|
||||
assert (backend);
|
||||
void *backend = zmq_socket (context, ZMQ_DEALER);
|
||||
assert (frontend);
|
||||
// Bind both sockets to TCP ports
|
||||
assert (zmq_bind (frontend, "tcp://*:5555") == 0);
|
||||
assert (zmq_bind (backend, "tcp://*:5556") == 0);
|
||||
// Start the queue proxy, which runs until ETERM
|
||||
zmq_proxy (frontend, backend, NULL);
|
||||
```
|
||||
|
||||
|
||||
# Polling indefinitely for input events on both a 0mq socket and a standard socket.
|
||||
|
||||
```
|
||||
typedef struct
|
||||
{
|
||||
void //*socket//;
|
||||
int //fd//;
|
||||
short //events//;
|
||||
short //revents//;
|
||||
} zmq_pollitem_t;
|
||||
|
||||
|
||||
zmq_pollitem_t items [2];
|
||||
/* First item refers to ØMQ socket 'socket' */
|
||||
items[0].socket = socket;
|
||||
items[0].events = ZMQ_POLLIN;
|
||||
/* Second item refers to standard socket 'fd' */
|
||||
items[1].socket = NULL;
|
||||
items[1].fd = fd;
|
||||
items[1].events = ZMQ_POLLIN;
|
||||
/* Poll for events indefinitely */
|
||||
int rc = zmq_poll (items, 2, -1);
|
||||
assert (rc >= 0); /* Returned events will be stored in items[].revents */
|
||||
```
|
||||
|
BIN
f77_zmq/examples/dummy_cipsi
Executable file
BIN
f77_zmq/examples/dummy_cipsi
Executable file
Binary file not shown.
27
f77_zmq/examples/dummy_cipsi.f
Normal file
27
f77_zmq/examples/dummy_cipsi.f
Normal file
@ -0,0 +1,27 @@
|
||||
program dummy_cispsi
|
||||
implicit none
|
||||
include 'f77_zmq.h'
|
||||
integer(ZMQ_PTR) context
|
||||
integer(ZMQ_PTR) responder
|
||||
character*(64) address
|
||||
character*(20) buffer
|
||||
integer rc
|
||||
|
||||
|
||||
address = 'tcp://*:5556'
|
||||
|
||||
context = f77_zmq_ctx_new()
|
||||
responder = f77_zmq_socket(context, ZMQ_PUB)
|
||||
rc = f77_zmq_bind(responder,address)
|
||||
|
||||
do
|
||||
print *, "send"
|
||||
rc = f77_zmq_send (responder, "log coucou", 10, 0)
|
||||
CALL SLEEP(1)
|
||||
enddo
|
||||
|
||||
|
||||
rc = f77_zmq_close(responder)
|
||||
rc = f77_zmq_ctx_destroy(context)
|
||||
end
|
||||
|
338
f77_zmq/examples/f77_zmq.h
Normal file
338
f77_zmq/examples/f77_zmq.h
Normal file
@ -0,0 +1,338 @@
|
||||
integer EADDRINUSE
|
||||
integer EADDRNOTAVAIL
|
||||
integer EAFNOSUPPORT
|
||||
integer ECONNABORTED
|
||||
integer ECONNREFUSED
|
||||
integer ECONNRESET
|
||||
integer EFSM
|
||||
integer EHOSTUNREACH
|
||||
integer EINPROGRESS
|
||||
integer EMSGSIZE
|
||||
integer EMTHREAD
|
||||
integer ENETDOWN
|
||||
integer ENETRESET
|
||||
integer ENETUNREACH
|
||||
integer ENOBUFS
|
||||
integer ENOCOMPATPROTO
|
||||
integer ENOTCONN
|
||||
integer ENOTSOCK
|
||||
integer ENOTSUP
|
||||
integer EPROTONOSUPPORT
|
||||
integer ETERM
|
||||
integer ETIMEDOUT
|
||||
integer ZMQ_AFFINITY
|
||||
integer ZMQ_BACKLOG
|
||||
integer ZMQ_CONFLATE
|
||||
integer ZMQ_CURVE
|
||||
integer ZMQ_CURVE_PUBLICKEY
|
||||
integer ZMQ_CURVE_SECRETKEY
|
||||
integer ZMQ_CURVE_SERVER
|
||||
integer ZMQ_CURVE_SERVERKEY
|
||||
integer ZMQ_DEALER
|
||||
integer ZMQ_DELAY_ATTACH_ON_CONNECT
|
||||
integer ZMQ_DONTWAIT
|
||||
integer ZMQ_EVENTS
|
||||
integer ZMQ_EVENT_ACCEPTED
|
||||
integer ZMQ_EVENT_ACCEPT_FAILED
|
||||
integer ZMQ_EVENT_ALL
|
||||
integer ZMQ_EVENT_BIND_FAILED
|
||||
integer ZMQ_EVENT_CLOSED
|
||||
integer ZMQ_EVENT_CLOSE_FAILED
|
||||
integer ZMQ_EVENT_CONNECTED
|
||||
integer ZMQ_EVENT_CONNECT_DELAYED
|
||||
integer ZMQ_EVENT_CONNECT_RETRIED
|
||||
integer ZMQ_EVENT_DISCONNECTED
|
||||
integer ZMQ_EVENT_LISTENING
|
||||
integer ZMQ_EVENT_MONITOR_STOPPED
|
||||
integer ZMQ_FAIL_UNROUTABLE
|
||||
integer ZMQ_FD
|
||||
integer ZMQ_FORWARDER
|
||||
integer ZMQ_HAUSNUMERO
|
||||
integer ZMQ_IDENTITY
|
||||
integer ZMQ_IMMEDIATE
|
||||
integer ZMQ_IO_THREADS
|
||||
integer ZMQ_IO_THREADS_DFLT
|
||||
integer ZMQ_IPV4ONLY
|
||||
integer ZMQ_IPV6
|
||||
integer ZMQ_LAST_ENDPOINT
|
||||
integer ZMQ_LINGER
|
||||
integer ZMQ_MAXMSGSIZE
|
||||
integer ZMQ_MAX_SOCKETS
|
||||
integer ZMQ_MAX_SOCKETS_DFLT
|
||||
integer ZMQ_MECHANISM
|
||||
integer ZMQ_MORE
|
||||
integer ZMQ_MULTICAST_HOPS
|
||||
integer ZMQ_NOBLOCK
|
||||
integer ZMQ_NULL
|
||||
integer ZMQ_PAIR
|
||||
integer ZMQ_PLAIN
|
||||
integer ZMQ_PLAIN_PASSWORD
|
||||
integer ZMQ_PLAIN_SERVER
|
||||
integer ZMQ_PLAIN_USERNAME
|
||||
integer ZMQ_POLLERR
|
||||
integer ZMQ_POLLIN
|
||||
integer ZMQ_POLLITEMS_DFLT
|
||||
integer ZMQ_POLLOUT
|
||||
integer ZMQ_PROBE_ROUTER
|
||||
integer ZMQ_PTR
|
||||
integer ZMQ_PUB
|
||||
integer ZMQ_PULL
|
||||
integer ZMQ_PUSH
|
||||
integer ZMQ_QUEUE
|
||||
integer ZMQ_RATE
|
||||
integer ZMQ_RCVBUF
|
||||
integer ZMQ_RCVHWM
|
||||
integer ZMQ_RCVMORE
|
||||
integer ZMQ_RCVTIMEO
|
||||
integer ZMQ_RECONNECT_IVL
|
||||
integer ZMQ_RECONNECT_IVL_MAX
|
||||
integer ZMQ_RECOVERY_IVL
|
||||
integer ZMQ_REP
|
||||
integer ZMQ_REQ
|
||||
integer ZMQ_REQ_CORRELATE
|
||||
integer ZMQ_REQ_RELAXED
|
||||
integer ZMQ_ROUTER
|
||||
integer ZMQ_ROUTER_BEHAVIOR
|
||||
integer ZMQ_ROUTER_MANDATORY
|
||||
integer ZMQ_ROUTER_RAW
|
||||
integer ZMQ_SNDBUF
|
||||
integer ZMQ_SNDHWM
|
||||
integer ZMQ_SNDMORE
|
||||
integer ZMQ_SNDTIMEO
|
||||
integer ZMQ_STREAM
|
||||
integer ZMQ_STREAMER
|
||||
integer ZMQ_SUB
|
||||
integer ZMQ_SUBSCRIBE
|
||||
integer ZMQ_TCP_ACCEPT_FILTER
|
||||
integer ZMQ_TCP_KEEPALIVE
|
||||
integer ZMQ_TCP_KEEPALIVE_CNT
|
||||
integer ZMQ_TCP_KEEPALIVE_IDLE
|
||||
integer ZMQ_TCP_KEEPALIVE_INTVL
|
||||
integer ZMQ_TYPE
|
||||
integer ZMQ_UNSUBSCRIBE
|
||||
integer ZMQ_VERSION
|
||||
integer ZMQ_VERSION_MAJOR
|
||||
integer ZMQ_VERSION_MINOR
|
||||
integer ZMQ_VERSION_PATCH
|
||||
integer ZMQ_XPUB
|
||||
integer ZMQ_XPUB_VERBOSE
|
||||
integer ZMQ_XREP
|
||||
integer ZMQ_XREQ
|
||||
integer ZMQ_XSUB
|
||||
integer ZMQ_ZAP_DOMAIN
|
||||
parameter ( EADDRINUSE = 156384717 )
|
||||
parameter ( EADDRNOTAVAIL = 156384718 )
|
||||
parameter ( EAFNOSUPPORT = 156384723 )
|
||||
parameter ( ECONNABORTED = 156384725 )
|
||||
parameter ( ECONNREFUSED = 156384719 )
|
||||
parameter ( ECONNRESET = 156384726 )
|
||||
parameter ( EFSM = 156384763 )
|
||||
parameter ( EHOSTUNREACH = 156384729 )
|
||||
parameter ( EINPROGRESS = 156384720 )
|
||||
parameter ( EMSGSIZE = 156384722 )
|
||||
parameter ( EMTHREAD = 156384766 )
|
||||
parameter ( ENETDOWN = 156384716 )
|
||||
parameter ( ENETRESET = 156384730 )
|
||||
parameter ( ENETUNREACH = 156384724 )
|
||||
parameter ( ENOBUFS = 156384715 )
|
||||
parameter ( ENOCOMPATPROTO = 156384764 )
|
||||
parameter ( ENOTCONN = 156384727 )
|
||||
parameter ( ENOTSOCK = 156384721 )
|
||||
parameter ( ENOTSUP = 156384713 )
|
||||
parameter ( EPROTONOSUPPORT = 156384714 )
|
||||
parameter ( ETERM = 156384765 )
|
||||
parameter ( ETIMEDOUT = 156384728 )
|
||||
parameter ( ZMQ_AFFINITY = 4 )
|
||||
parameter ( ZMQ_BACKLOG = 19 )
|
||||
parameter ( ZMQ_CONFLATE = 54 )
|
||||
parameter ( ZMQ_CURVE = 2 )
|
||||
parameter ( ZMQ_CURVE_PUBLICKEY = 48 )
|
||||
parameter ( ZMQ_CURVE_SECRETKEY = 49 )
|
||||
parameter ( ZMQ_CURVE_SERVER = 47 )
|
||||
parameter ( ZMQ_CURVE_SERVERKEY = 50 )
|
||||
parameter ( ZMQ_DEALER = 5 )
|
||||
parameter ( ZMQ_DELAY_ATTACH_ON_CONNECT = 39 )
|
||||
parameter ( ZMQ_DONTWAIT = 1 )
|
||||
parameter ( ZMQ_EVENTS = 15 )
|
||||
parameter ( ZMQ_EVENT_ACCEPTED = 32 )
|
||||
parameter ( ZMQ_EVENT_ACCEPT_FAILED = 64 )
|
||||
parameter ( ZMQ_EVENT_ALL = 2047 )
|
||||
parameter ( ZMQ_EVENT_BIND_FAILED = 16 )
|
||||
parameter ( ZMQ_EVENT_CLOSED = 128 )
|
||||
parameter ( ZMQ_EVENT_CLOSE_FAILED = 256 )
|
||||
parameter ( ZMQ_EVENT_CONNECTED = 1 )
|
||||
parameter ( ZMQ_EVENT_CONNECT_DELAYED = 2 )
|
||||
parameter ( ZMQ_EVENT_CONNECT_RETRIED = 4 )
|
||||
parameter ( ZMQ_EVENT_DISCONNECTED = 512 )
|
||||
parameter ( ZMQ_EVENT_LISTENING = 8 )
|
||||
parameter ( ZMQ_EVENT_MONITOR_STOPPED = 1024 )
|
||||
parameter ( ZMQ_FAIL_UNROUTABLE = 33 )
|
||||
parameter ( ZMQ_FD = 14 )
|
||||
parameter ( ZMQ_FORWARDER = 2 )
|
||||
parameter ( ZMQ_HAUSNUMERO = 156384712 )
|
||||
parameter ( ZMQ_IDENTITY = 5 )
|
||||
parameter ( ZMQ_IMMEDIATE = 39 )
|
||||
parameter ( ZMQ_IO_THREADS = 1 )
|
||||
parameter ( ZMQ_IO_THREADS_DFLT = 1 )
|
||||
parameter ( ZMQ_IPV4ONLY = 31 )
|
||||
parameter ( ZMQ_IPV6 = 42 )
|
||||
parameter ( ZMQ_LAST_ENDPOINT = 32 )
|
||||
parameter ( ZMQ_LINGER = 17 )
|
||||
parameter ( ZMQ_MAXMSGSIZE = 22 )
|
||||
parameter ( ZMQ_MAX_SOCKETS = 2 )
|
||||
parameter ( ZMQ_MAX_SOCKETS_DFLT = 1023 )
|
||||
parameter ( ZMQ_MECHANISM = 43 )
|
||||
parameter ( ZMQ_MORE = 1 )
|
||||
parameter ( ZMQ_MULTICAST_HOPS = 25 )
|
||||
parameter ( ZMQ_NOBLOCK = 1 )
|
||||
parameter ( ZMQ_NULL = 0 )
|
||||
parameter ( ZMQ_PAIR = 0 )
|
||||
parameter ( ZMQ_PLAIN = 1 )
|
||||
parameter ( ZMQ_PLAIN_PASSWORD = 46 )
|
||||
parameter ( ZMQ_PLAIN_SERVER = 44 )
|
||||
parameter ( ZMQ_PLAIN_USERNAME = 45 )
|
||||
parameter ( ZMQ_POLLERR = 4 )
|
||||
parameter ( ZMQ_POLLIN = 1 )
|
||||
parameter ( ZMQ_POLLITEMS_DFLT = 16 )
|
||||
parameter ( ZMQ_POLLOUT = 2 )
|
||||
parameter ( ZMQ_PROBE_ROUTER = 51 )
|
||||
parameter ( ZMQ_PTR = 8 )
|
||||
parameter ( ZMQ_PUB = 1 )
|
||||
parameter ( ZMQ_PULL = 7 )
|
||||
parameter ( ZMQ_PUSH = 8 )
|
||||
parameter ( ZMQ_QUEUE = 3 )
|
||||
parameter ( ZMQ_RATE = 8 )
|
||||
parameter ( ZMQ_RCVBUF = 12 )
|
||||
parameter ( ZMQ_RCVHWM = 24 )
|
||||
parameter ( ZMQ_RCVMORE = 13 )
|
||||
parameter ( ZMQ_RCVTIMEO = 27 )
|
||||
parameter ( ZMQ_RECONNECT_IVL = 18 )
|
||||
parameter ( ZMQ_RECONNECT_IVL_MAX = 21 )
|
||||
parameter ( ZMQ_RECOVERY_IVL = 9 )
|
||||
parameter ( ZMQ_REP = 4 )
|
||||
parameter ( ZMQ_REQ = 3 )
|
||||
parameter ( ZMQ_REQ_CORRELATE = 52 )
|
||||
parameter ( ZMQ_REQ_RELAXED = 53 )
|
||||
parameter ( ZMQ_ROUTER = 6 )
|
||||
parameter ( ZMQ_ROUTER_BEHAVIOR = 33 )
|
||||
parameter ( ZMQ_ROUTER_MANDATORY = 33 )
|
||||
parameter ( ZMQ_ROUTER_RAW = 41 )
|
||||
parameter ( ZMQ_SNDBUF = 11 )
|
||||
parameter ( ZMQ_SNDHWM = 23 )
|
||||
parameter ( ZMQ_SNDMORE = 2 )
|
||||
parameter ( ZMQ_SNDTIMEO = 28 )
|
||||
parameter ( ZMQ_STREAM = 11 )
|
||||
parameter ( ZMQ_STREAMER = 1 )
|
||||
parameter ( ZMQ_SUB = 2 )
|
||||
parameter ( ZMQ_SUBSCRIBE = 6 )
|
||||
parameter ( ZMQ_TCP_ACCEPT_FILTER = 38 )
|
||||
parameter ( ZMQ_TCP_KEEPALIVE = 34 )
|
||||
parameter ( ZMQ_TCP_KEEPALIVE_CNT = 35 )
|
||||
parameter ( ZMQ_TCP_KEEPALIVE_IDLE = 36 )
|
||||
parameter ( ZMQ_TCP_KEEPALIVE_INTVL = 37 )
|
||||
parameter ( ZMQ_TYPE = 16 )
|
||||
parameter ( ZMQ_UNSUBSCRIBE = 7 )
|
||||
parameter ( ZMQ_VERSION = 40005 )
|
||||
parameter ( ZMQ_VERSION_MAJOR = 4 )
|
||||
parameter ( ZMQ_VERSION_MINOR = 0 )
|
||||
parameter ( ZMQ_VERSION_PATCH = 5 )
|
||||
parameter ( ZMQ_XPUB = 9 )
|
||||
parameter ( ZMQ_XPUB_VERBOSE = 40 )
|
||||
parameter ( ZMQ_XREP = 6 )
|
||||
parameter ( ZMQ_XREQ = 5 )
|
||||
parameter ( ZMQ_XSUB = 10 )
|
||||
parameter ( ZMQ_ZAP_DOMAIN = 55 )
|
||||
integer f77_zmq_bind
|
||||
external f77_zmq_bind
|
||||
integer f77_zmq_close
|
||||
external f77_zmq_close
|
||||
integer f77_zmq_connect
|
||||
external f77_zmq_connect
|
||||
integer f77_zmq_ctx_destroy
|
||||
external f77_zmq_ctx_destroy
|
||||
integer*8 f77_zmq_ctx_new
|
||||
external f77_zmq_ctx_new
|
||||
integer f77_zmq_ctx_set
|
||||
external f77_zmq_ctx_set
|
||||
integer f77_zmq_ctx_shutdown
|
||||
external f77_zmq_ctx_shutdown
|
||||
integer f77_zmq_ctx_term
|
||||
external f77_zmq_ctx_term
|
||||
integer f77_zmq_disconnect
|
||||
external f77_zmq_disconnect
|
||||
integer f77_zmq_errno
|
||||
external f77_zmq_errno
|
||||
integer f77_zmq_event_destroy
|
||||
external f77_zmq_event_destroy
|
||||
integer f77_zmq_event_event
|
||||
external f77_zmq_event_event
|
||||
integer*8 f77_zmq_event_new
|
||||
external f77_zmq_event_new
|
||||
integer f77_zmq_event_set_event
|
||||
external f77_zmq_event_set_event
|
||||
integer f77_zmq_event_set_value
|
||||
external f77_zmq_event_set_value
|
||||
integer f77_zmq_event_value
|
||||
external f77_zmq_event_value
|
||||
integer f77_zmq_getsockopt
|
||||
external f77_zmq_getsockopt
|
||||
integer f77_zmq_msg_close
|
||||
external f77_zmq_msg_close
|
||||
integer f77_zmq_msg_copy
|
||||
external f77_zmq_msg_copy
|
||||
integer f77_zmq_msg_copy_from_data
|
||||
external f77_zmq_msg_copy_from_data
|
||||
integer f77_zmq_msg_copy_to_data
|
||||
external f77_zmq_msg_copy_to_data
|
||||
integer*8 f77_zmq_msg_data
|
||||
external f77_zmq_msg_data
|
||||
integer*8 f77_zmq_msg_data_new
|
||||
external f77_zmq_msg_data_new
|
||||
integer f77_zmq_msg_destroy
|
||||
external f77_zmq_msg_destroy
|
||||
integer f77_zmq_msg_destroy_data
|
||||
external f77_zmq_msg_destroy_data
|
||||
integer f77_zmq_msg_get
|
||||
external f77_zmq_msg_get
|
||||
integer f77_zmq_msg_init
|
||||
external f77_zmq_msg_init
|
||||
integer f77_zmq_msg_init_data
|
||||
external f77_zmq_msg_init_data
|
||||
integer f77_zmq_msg_init_size
|
||||
external f77_zmq_msg_init_size
|
||||
integer f77_zmq_msg_more
|
||||
external f77_zmq_msg_more
|
||||
integer f77_zmq_msg_move
|
||||
external f77_zmq_msg_move
|
||||
integer*8 f77_zmq_msg_new
|
||||
external f77_zmq_msg_new
|
||||
integer f77_zmq_msg_recv
|
||||
external f77_zmq_msg_recv
|
||||
integer f77_zmq_msg_send
|
||||
external f77_zmq_msg_send
|
||||
integer f77_zmq_msg_set
|
||||
external f77_zmq_msg_set
|
||||
integer f77_zmq_msg_size
|
||||
external f77_zmq_msg_size
|
||||
integer f77_zmq_poll
|
||||
external f77_zmq_poll
|
||||
integer f77_zmq_pollitem_destroy
|
||||
external f77_zmq_pollitem_destroy
|
||||
integer*8 f77_zmq_pollitem_new
|
||||
external f77_zmq_pollitem_new
|
||||
integer f77_zmq_proxy
|
||||
external f77_zmq_proxy
|
||||
integer f77_zmq_recv
|
||||
external f77_zmq_recv
|
||||
integer f77_zmq_send
|
||||
external f77_zmq_send
|
||||
integer f77_zmq_setsockopt
|
||||
external f77_zmq_setsockopt
|
||||
integer*8 f77_zmq_socket
|
||||
external f77_zmq_socket
|
||||
integer f77_zmq_socket_monitor
|
||||
external f77_zmq_socket_monitor
|
||||
character*(256) f77_zmq_strerror
|
||||
external f77_zmq_strerror
|
||||
integer f77_zmq_unbind
|
||||
external f77_zmq_unbind
|
8
f77_zmq/examples/hw.sh
Executable file
8
f77_zmq/examples/hw.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
source shell_functions.sh
|
||||
|
||||
SERVER=./hwserver
|
||||
CLIENT=./hwclient
|
||||
|
||||
run
|
8
f77_zmq/examples/hw_msg.sh
Executable file
8
f77_zmq/examples/hw_msg.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
source shell_functions.sh
|
||||
|
||||
SERVER=./hwserver_msg
|
||||
CLIENT=./hwclient_msg
|
||||
|
||||
run
|
BIN
f77_zmq/examples/hwclient
Executable file
BIN
f77_zmq/examples/hwclient
Executable file
Binary file not shown.
30
f77_zmq/examples/hwclient.f
Normal file
30
f77_zmq/examples/hwclient.f
Normal file
@ -0,0 +1,30 @@
|
||||
program server
|
||||
implicit none
|
||||
include 'f77_zmq.h'
|
||||
integer(ZMQ_PTR) context
|
||||
integer(ZMQ_PTR) requester
|
||||
character*(64) address
|
||||
character*(20) buffer
|
||||
integer rc
|
||||
integer i
|
||||
|
||||
|
||||
address = 'tcp://localhost:5555'
|
||||
|
||||
context = f77_zmq_ctx_new()
|
||||
requester = f77_zmq_socket(context, ZMQ_REQ)
|
||||
rc = f77_zmq_connect(requester,address)
|
||||
|
||||
do i=1,10
|
||||
rc = f77_zmq_send(requester, "Hello!", 6, 0)
|
||||
rc = f77_zmq_recv(requester, buffer, 20, 0)
|
||||
print *, i, 'Received :', buffer(1:rc)
|
||||
enddo
|
||||
rc = f77_zmq_send(requester, "end", 3, 0)
|
||||
rc = f77_zmq_recv(requester, buffer, 20, 0)
|
||||
|
||||
rc = f77_zmq_close(requester)
|
||||
rc = f77_zmq_ctx_destroy(context)
|
||||
|
||||
end
|
||||
|
BIN
f77_zmq/examples/hwclient_msg
Executable file
BIN
f77_zmq/examples/hwclient_msg
Executable file
Binary file not shown.
35
f77_zmq/examples/hwclient_msg.f
Normal file
35
f77_zmq/examples/hwclient_msg.f
Normal file
@ -0,0 +1,35 @@
|
||||
program server
|
||||
implicit none
|
||||
include 'f77_zmq.h'
|
||||
integer(ZMQ_PTR) context
|
||||
integer(ZMQ_PTR) requester, term
|
||||
character*(64) address, termination_addr
|
||||
character*(20) buffer
|
||||
integer rc
|
||||
integer i
|
||||
|
||||
|
||||
address = 'tcp://localhost:5555'
|
||||
termination_addr = 'tcp://localhost:5556'
|
||||
|
||||
|
||||
context = f77_zmq_ctx_new()
|
||||
requester = f77_zmq_socket(context, ZMQ_REQ)
|
||||
rc = f77_zmq_connect(requester,address)
|
||||
term = f77_zmq_socket(context, ZMQ_PUSH)
|
||||
rc = f77_zmq_connect(term,termination_addr)
|
||||
|
||||
do i=1,10
|
||||
rc = f77_zmq_send(term, '1', 1, 0)
|
||||
rc = f77_zmq_send(requester, 'Hello!', 6, 0)
|
||||
rc = f77_zmq_recv(requester, buffer, 20, 0)
|
||||
print *, i, 'Received :', buffer(1:rc)
|
||||
enddo
|
||||
rc = f77_zmq_send(term, "0", 1, 0)
|
||||
|
||||
rc = f77_zmq_close(term)
|
||||
rc = f77_zmq_close(requester)
|
||||
rc = f77_zmq_ctx_destroy(context)
|
||||
|
||||
end
|
||||
|
BIN
f77_zmq/examples/hwserver
Executable file
BIN
f77_zmq/examples/hwserver
Executable file
Binary file not shown.
31
f77_zmq/examples/hwserver.f
Normal file
31
f77_zmq/examples/hwserver.f
Normal file
@ -0,0 +1,31 @@
|
||||
program server
|
||||
implicit none
|
||||
include 'f77_zmq.h'
|
||||
integer(ZMQ_PTR) context
|
||||
integer(ZMQ_PTR) responder
|
||||
character*(64) address
|
||||
character*(20) buffer
|
||||
integer rc
|
||||
|
||||
|
||||
address = 'tcp://*:5555'
|
||||
|
||||
context = f77_zmq_ctx_new()
|
||||
responder = f77_zmq_socket(context, ZMQ_REP)
|
||||
rc = f77_zmq_bind(responder,address)
|
||||
|
||||
do
|
||||
rc = f77_zmq_recv(responder, buffer, 20, 0)
|
||||
print *, 'Received :', buffer(1:rc)
|
||||
if (buffer(1:rc) /= 'end') then
|
||||
rc = f77_zmq_send (responder, "world", 5, 0)
|
||||
else
|
||||
rc = f77_zmq_send (responder, "end", 3, 0)
|
||||
exit
|
||||
endif
|
||||
enddo
|
||||
|
||||
rc = f77_zmq_close(responder)
|
||||
rc = f77_zmq_ctx_destroy(context)
|
||||
end
|
||||
|
BIN
f77_zmq/examples/hwserver_msg
Executable file
BIN
f77_zmq/examples/hwserver_msg
Executable file
Binary file not shown.
131
f77_zmq/examples/hwserver_msg.f
Normal file
131
f77_zmq/examples/hwserver_msg.f
Normal file
@ -0,0 +1,131 @@
|
||||
program server
|
||||
implicit none
|
||||
include 'f77_zmq.h'
|
||||
integer(ZMQ_PTR) context
|
||||
integer(ZMQ_PTR) term
|
||||
integer(ZMQ_PTR) responder
|
||||
integer(ZMQ_PTR) request, reply
|
||||
integer(ZMQ_PTR) msg_data
|
||||
character*(64) address, termination_addr
|
||||
character*(20) buffer
|
||||
integer rc
|
||||
|
||||
|
||||
address = 'tcp://*:5555'
|
||||
termination_addr = 'tcp://*:5556'
|
||||
|
||||
context = f77_zmq_ctx_new()
|
||||
|
||||
term = f77_zmq_socket(context, ZMQ_PULL)
|
||||
rc = f77_zmq_bind(term,termination_addr)
|
||||
rc = f77_zmq_recv(term, buffer, 20, 0)
|
||||
|
||||
responder = f77_zmq_socket(context, ZMQ_REP)
|
||||
rc = f77_zmq_bind(responder,address)
|
||||
|
||||
request = f77_zmq_msg_new()
|
||||
reply = f77_zmq_msg_new()
|
||||
|
||||
do
|
||||
|
||||
! Example with f77_zmq_msg_copy_to/from_data
|
||||
print *, 'msg_copy_from/to'
|
||||
rc = f77_zmq_msg_init(request)
|
||||
if (rc /= 0) stop 'f77_zmq_msg_init failed'
|
||||
|
||||
rc = f77_zmq_msg_recv(request, responder, 0)
|
||||
|
||||
rc = f77_zmq_msg_copy_from_data (request, buffer)
|
||||
|
||||
print *, 'Received :', buffer(1:rc)
|
||||
|
||||
rc = f77_zmq_msg_close(request)
|
||||
if (rc /= 0) stop 'f77_zmq_msg_close failed'
|
||||
|
||||
rc = f77_zmq_msg_init_size(reply,5)
|
||||
if (rc /= 0) stop 'f77_zmq_msg_init_size failed'
|
||||
|
||||
buffer = 'World'
|
||||
rc = f77_zmq_msg_copy_to_data (reply, buffer, 5)
|
||||
if (rc /= 0) stop 'f77_zmq_msg_copy_to_data failed'
|
||||
|
||||
rc = f77_zmq_msg_send(reply, responder, 0)
|
||||
|
||||
rc = f77_zmq_msg_close(reply)
|
||||
if (rc /= 0) stop 'f77_zmq_msg_close failed'
|
||||
|
||||
rc = f77_zmq_recv(term, buffer, 1, 0)
|
||||
if (buffer(1:1) == '0') then
|
||||
exit
|
||||
endif
|
||||
|
||||
|
||||
! Example with f77_zmq_msg_copy
|
||||
print *, 'msg_copy'
|
||||
|
||||
rc = f77_zmq_msg_init(request)
|
||||
if (rc /= 0) stop 'f77_zmq_msg_init failed'
|
||||
|
||||
rc = f77_zmq_msg_init(reply)
|
||||
if (rc /= 0) stop 'f77_zmq_msg_init failed'
|
||||
|
||||
|
||||
rc = f77_zmq_msg_recv(request, responder, 0)
|
||||
rc = f77_zmq_msg_copy(reply,request)
|
||||
if (rc /= 0) stop 'f77_zmq_msg_copy failed'
|
||||
|
||||
rc = f77_zmq_msg_close(request)
|
||||
if (rc /= 0) stop 'f77_zmq_msg_close failed'
|
||||
|
||||
rc = f77_zmq_msg_send(reply, responder, 0)
|
||||
|
||||
rc = f77_zmq_msg_close(reply)
|
||||
if (rc /= 0) stop 'f77_zmq_msg_close failed'
|
||||
|
||||
rc = f77_zmq_recv(term, buffer, 1, 0)
|
||||
if (buffer(1:1) == '0') then
|
||||
exit
|
||||
endif
|
||||
|
||||
|
||||
! Example with f77_zmq_msg_init_data
|
||||
print *, 'msg_new/destroy_data'
|
||||
rc = f77_zmq_msg_init(request)
|
||||
if (rc /= 0) stop 'f77_zmq_msg_init failed'
|
||||
|
||||
rc = f77_zmq_msg_recv(request, responder, 0)
|
||||
|
||||
rc = f77_zmq_msg_copy_from_data (request, buffer)
|
||||
|
||||
print *, 'Received :', buffer(1:rc)
|
||||
|
||||
rc = f77_zmq_msg_close(request)
|
||||
if (rc /= 0) stop 'f77_zmq_msg_close failed'
|
||||
|
||||
|
||||
msg_data = f77_zmq_msg_data_new(10,'world',10)
|
||||
|
||||
rc = f77_zmq_msg_init_data(reply,msg_data,6)
|
||||
if (rc /= 0) stop 'f77_zmq_msg_init_data failed'
|
||||
|
||||
rc = f77_zmq_msg_send(reply, responder, 0)
|
||||
|
||||
rc = f77_zmq_msg_close(reply)
|
||||
if (rc /= 0) stop 'f77_zmq_msg_close failed'
|
||||
|
||||
rc = f77_zmq_recv(term, buffer, 1, 0)
|
||||
|
||||
! rc = f77_zmq_msg_destroy_data (msg_data)
|
||||
if (buffer(1:1) == '0') then
|
||||
exit
|
||||
endif
|
||||
|
||||
enddo
|
||||
rc = f77_zmq_msg_destroy(request)
|
||||
rc = f77_zmq_msg_destroy(reply)
|
||||
|
||||
rc = f77_zmq_close(responder)
|
||||
rc = f77_zmq_close(term)
|
||||
rc = f77_zmq_ctx_destroy(context)
|
||||
|
||||
end
|
44
f77_zmq/examples/shell_functions.sh
Normal file
44
f77_zmq/examples/shell_functions.sh
Normal file
@ -0,0 +1,44 @@
|
||||
#!/bin/bash
|
||||
|
||||
function run()
|
||||
{
|
||||
make $SERVER $CLIENT
|
||||
TMPDIR=$(mktemp -d)
|
||||
resize > $TMPDIR/size
|
||||
source $TMPDIR/size
|
||||
|
||||
declare -i H
|
||||
H=$LINES-2
|
||||
|
||||
declare -i W
|
||||
W=$COLUMNS/2-2
|
||||
|
||||
echo $H $W
|
||||
|
||||
OUT1=$TMPDIR/out1
|
||||
OUT2=$TMPDIR/out2
|
||||
touch $OUT1 $OUT2
|
||||
|
||||
(echo "SERVER" > $OUT1 ;\
|
||||
echo "======" >> $OUT1 ;\
|
||||
$SERVER &>> $OUT1 ) &
|
||||
(echo "CLIENT" > $OUT2 ;\
|
||||
echo "======" >> $OUT2 ;\
|
||||
$CLIENT &>> $OUT2 ) &
|
||||
|
||||
dialog \
|
||||
--begin 1 1 \
|
||||
--tailboxbg $OUT2 $H $W \
|
||||
--and-widget \
|
||||
--begin 1 $(echo 2+$W | bc -l) \
|
||||
--tailboxbg $OUT1 $(echo $H-7 | bc -l) $W \
|
||||
--and-widget \
|
||||
--begin $(echo $H-5 |bc -l) $(echo 2+$W | bc -l) \
|
||||
--yesno "close?" 5 $W
|
||||
|
||||
ps x | grep $SERVER | cut -d ' ' -f 1 | xargs kill 2> /dev/null
|
||||
ps x | grep $CLIENT | cut -d ' ' -f 1 | xargs kill 2> /dev/null
|
||||
|
||||
rm -rf $TMPDIR
|
||||
}
|
||||
|
8
f77_zmq/examples/socket_monitor
Executable file
8
f77_zmq/examples/socket_monitor
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
source shell_functions.sh
|
||||
|
||||
SERVER=./socket_monitor_server
|
||||
CLIENT=./socket_monitor_client
|
||||
|
||||
run
|
8
f77_zmq/examples/socket_monitor.sh
Executable file
8
f77_zmq/examples/socket_monitor.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
source shell_functions.sh
|
||||
|
||||
SERVER=./socket_monitor_server
|
||||
CLIENT=./socket_monitor_client
|
||||
|
||||
run
|
33
f77_zmq/examples/socket_monitor_client.f
Normal file
33
f77_zmq/examples/socket_monitor_client.f
Normal file
@ -0,0 +1,33 @@
|
||||
program socketmonitor_client
|
||||
implicit none
|
||||
include 'f77_zmq.h'
|
||||
character*(32) addr
|
||||
integer(ZMQ_PTR) ctx
|
||||
integer(ZMQ_PTR) req
|
||||
character*(20) buffer
|
||||
integer rc
|
||||
|
||||
! Wait a litle bit
|
||||
call sleep(1)
|
||||
|
||||
! Context
|
||||
addr = 'tcp://127.0.0.1:6666'
|
||||
ctx = f77_zmq_ctx_new ()
|
||||
|
||||
! REQ socket
|
||||
req = f77_zmq_socket (ctx, ZMQ_REQ)
|
||||
rc = f77_zmq_connect(req,addr)
|
||||
if (rc /= 0) stop 'Failed f77_zmq_connect(req,addr)'
|
||||
|
||||
print *, 'sending hello'
|
||||
rc = f77_zmq_send(req, "Hello!", 6, 0)
|
||||
print *, 'waiting for reply'
|
||||
rc = f77_zmq_recv(req, buffer, 20, 0)
|
||||
print *, 'received ', buffer(1:rc)
|
||||
|
||||
! Close the REQ socket
|
||||
rc = f77_zmq_close(req)
|
||||
|
||||
rc = f77_zmq_ctx_destroy(ctx)
|
||||
|
||||
end
|
160
f77_zmq/examples/socket_monitor_server.f
Normal file
160
f77_zmq/examples/socket_monitor_server.f
Normal file
@ -0,0 +1,160 @@
|
||||
integer function read_msg(s, event, ep)
|
||||
implicit none
|
||||
include 'f77_zmq.h'
|
||||
integer(ZMQ_PTR) s, event
|
||||
character*(*) ep
|
||||
|
||||
integer(ZMQ_PTR) msg1, msg2
|
||||
integer rc
|
||||
|
||||
integer(ZMQ_PTR) data
|
||||
integer*2 data_msg(4)
|
||||
|
||||
msg1 = f77_zmq_msg_new() ! Binary part
|
||||
rc = f77_zmq_msg_init(msg1)
|
||||
if (rc /= 0) stop 'Unable to initialize msg1'
|
||||
|
||||
msg2 = f77_zmq_msg_new() ! Address part
|
||||
rc = f77_zmq_msg_init(msg2)
|
||||
if (rc /= 0) stop 'Unable to initialize msg2'
|
||||
|
||||
rc = f77_zmq_msg_recv (msg1, s, 0)
|
||||
if ( (rc == -1).and.(f77_zmq_errno() == ETERM) ) then
|
||||
read_msg = 1
|
||||
return
|
||||
endif
|
||||
if (rc == -1) stop 'Error in f77_zmq_msg_recv (msg1, s, 0)'
|
||||
|
||||
rc = f77_zmq_msg_more(msg1)
|
||||
if (rc == 0) stop 'Error in rc = zmq_msg_more(msg1)'
|
||||
|
||||
|
||||
rc = f77_zmq_msg_recv (msg2, s, 0)
|
||||
if ( (rc == -1).and.(f77_zmq_errno() == ETERM) ) then
|
||||
read_msg = 1
|
||||
return
|
||||
endif
|
||||
if (rc == -1) stop 'Error in f77_zmq_msg_recv (msg2, s, 0)'
|
||||
|
||||
rc = f77_zmq_msg_more(msg2)
|
||||
if (rc /= 0) stop 'Error in rc = zmq_msg_more(msg2)'
|
||||
|
||||
! Copy binary data to event struct
|
||||
rc = f77_zmq_msg_copy_from_data(msg1, data_msg)
|
||||
if (rc /= 6) then
|
||||
stop 'Failed in f77_zmq_msg_copy_from_data(msg1,data_int)'
|
||||
endif
|
||||
|
||||
event = f77_zmq_event_new()
|
||||
rc = f77_zmq_event_set_event(event,data_msg(1))
|
||||
rc = f77_zmq_event_set_value(event,data_msg(2))
|
||||
|
||||
! Copy address part
|
||||
ep = ''
|
||||
rc = f77_zmq_msg_copy_from_data(msg2, ep)
|
||||
if (rc == 0) then
|
||||
stop 'Failed in f77_zmq_msg_copy_from_data(msg2,ep)'
|
||||
endif
|
||||
ep = ep(1:rc)
|
||||
read_msg = 0
|
||||
return
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
subroutine rep_socket_monitor(ctx)
|
||||
implicit none
|
||||
include 'f77_zmq.h'
|
||||
integer(ZMQ_PTR) ctx
|
||||
integer(ZMQ_PTR) event
|
||||
integer(ZMQ_PTR) s
|
||||
character*(64) addr
|
||||
integer rc
|
||||
integer read_msg
|
||||
integer ev, val
|
||||
|
||||
event = f77_zmq_event_new()
|
||||
print *, 'Starting monitor'
|
||||
|
||||
s = f77_zmq_socket(ctx,ZMQ_PAIR)
|
||||
|
||||
rc = f77_zmq_connect(s, 'inproc://monitor.rep')
|
||||
if (rc /= 0) then
|
||||
stop 'Failed in f77_zmq_connect(s,inproc://monitor.rep)'
|
||||
endif
|
||||
|
||||
do while (read_msg(s, event, addr) == 0)
|
||||
ev = f77_zmq_event_event(event)
|
||||
val = f77_zmq_event_value(event)
|
||||
if (ev == ZMQ_EVENT_LISTENING) then
|
||||
print *, 'listening socket descriptor ', val
|
||||
print *, 'listening socket address ', trim(addr)
|
||||
else if (ev == ZMQ_EVENT_ACCEPTED) then
|
||||
print *, 'accepted socket descriptor', val
|
||||
print *, 'accepted socket address ', trim(addr)
|
||||
else if (ev == ZMQ_EVENT_CLOSE_FAILED) then
|
||||
print *, 'socket close failure error code ', val
|
||||
print *, 'socket address', trim(addr)
|
||||
else if (ev == ZMQ_EVENT_CLOSED) then
|
||||
print *, 'closed socket descriptor', val
|
||||
print *, 'closed socket address ', trim(addr)
|
||||
else if (ev ==ZMQ_EVENT_DISCONNECTED) then
|
||||
print *, 'disconnected socket descriptor', val
|
||||
print *, 'disconnected socket address ', trim(addr)
|
||||
endif
|
||||
|
||||
enddo
|
||||
rc = f77_zmq_close(s)
|
||||
if (rc /= 0) stop 'Failed in f77_zmq_close(s)'
|
||||
|
||||
end
|
||||
|
||||
program socketmonitor
|
||||
implicit none
|
||||
include 'f77_zmq.h'
|
||||
character*(32) addr
|
||||
integer(ZMQ_PTR) ctx
|
||||
integer(ZMQ_PTR) rep
|
||||
integer rc
|
||||
character*(20) buffer
|
||||
|
||||
! Context
|
||||
addr = 'tcp://127.0.0.1:6666'
|
||||
ctx = f77_zmq_ctx_new ()
|
||||
|
||||
! REP socket
|
||||
rep = f77_zmq_socket (ctx, ZMQ_REP)
|
||||
|
||||
! REP socket monitor, all events
|
||||
rc = f77_zmq_socket_monitor (rep, "inproc://monitor.rep",
|
||||
& ZMQ_EVENT_ALL)
|
||||
|
||||
!$OMP PARALLEL SECTIONS DEFAULT(SHARED)
|
||||
|
||||
!$OMP SECTION
|
||||
|
||||
call rep_socket_monitor(ctx)
|
||||
|
||||
!$OMP SECTION
|
||||
|
||||
rc = f77_zmq_bind (rep, addr)
|
||||
|
||||
! Allow some time for event detection
|
||||
call sleep(1)
|
||||
|
||||
print *, 'waiting'
|
||||
rc = f77_zmq_recv(rep, buffer, 20, 0)
|
||||
print *, 'received ', buffer(1:rc)
|
||||
print *, 'sending reply'
|
||||
rc = f77_zmq_send(rep, "World", 5, 0)
|
||||
print *, 'done'
|
||||
|
||||
! Close the REP socket
|
||||
rc = f77_zmq_close(rep)
|
||||
|
||||
rc = f77_zmq_ctx_destroy(ctx)
|
||||
|
||||
!$OMP END PARALLEL SECTIONS
|
||||
|
||||
end
|
22
f77_zmq/examples/vent.sh
Executable file
22
f77_zmq/examples/vent.sh
Executable file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
source shell_functions.sh
|
||||
|
||||
function ventclient ()
|
||||
{
|
||||
for i in {1..4}
|
||||
do
|
||||
./ventclient &
|
||||
done
|
||||
wait
|
||||
}
|
||||
|
||||
function ventserver ()
|
||||
{
|
||||
(sleep 2 ; echo) | ./ventserver
|
||||
}
|
||||
|
||||
SERVER=ventserver
|
||||
CLIENT=ventclient
|
||||
|
||||
run
|
BIN
f77_zmq/examples/ventclient
Executable file
BIN
f77_zmq/examples/ventclient
Executable file
Binary file not shown.
55
f77_zmq/examples/ventclient.f
Normal file
55
f77_zmq/examples/ventclient.f
Normal file
@ -0,0 +1,55 @@
|
||||
program task_ventilator
|
||||
! Task worker
|
||||
! Connects PULL socket to tcp://localhost:5557
|
||||
! Collects workloads from ventilator via that socket
|
||||
! Connects PUSH socket to tcp://localhost:5558
|
||||
! Sends results to sink via that socket
|
||||
implicit none
|
||||
include 'f77_zmq.h'
|
||||
|
||||
integer(ZMQ_PTR) context
|
||||
integer(ZMQ_PTR) sender, receiver, sink
|
||||
integer rc
|
||||
integer msecs
|
||||
character*(20) string
|
||||
|
||||
! Socket to receive messages on
|
||||
context = f77_zmq_ctx_new()
|
||||
receiver = f77_zmq_socket(context,ZMQ_PULL)
|
||||
rc = f77_zmq_connect (receiver, "tcp://localhost:5557")
|
||||
if (rc /= 0) stop '1st Connect failed'
|
||||
|
||||
! Socket to send messages to
|
||||
sender = f77_zmq_socket (context, ZMQ_PUSH);
|
||||
rc = f77_zmq_connect (sender, "tcp://localhost:5558");
|
||||
if (rc /= 0) stop '2nd Connect failed'
|
||||
|
||||
! Process tasks forever
|
||||
do
|
||||
rc = f77_zmq_recv (receiver, string, 20, 0)
|
||||
print '(A)', string(1:rc)
|
||||
read(string(1:rc),*) msecs
|
||||
call milli_sleep(msecs)
|
||||
rc = f77_zmq_send (sender, "", 0, 0) ! Send results to sink
|
||||
enddo
|
||||
rc = f77_zmq_close (receiver);
|
||||
rc = f77_zmq_close (sender);
|
||||
rc = f77_zmq_ctx_destroy (context);
|
||||
end
|
||||
|
||||
subroutine milli_sleep(ms)
|
||||
implicit none
|
||||
integer ms
|
||||
integer t(8), ms1, ms2
|
||||
call date_and_time(values=t)
|
||||
ms1=(t(5)*3600+t(6)*60+t(7))*1000+t(8)
|
||||
do ! check time:
|
||||
call date_and_time(values=t)
|
||||
ms2=(t(5)*3600+t(6)*60+t(7))*1000+t(8)
|
||||
if(ms2<ms1) then
|
||||
ms1 = ms1 - 24*3600*1000
|
||||
endif
|
||||
if(ms2-ms1>=ms)exit
|
||||
enddo
|
||||
|
||||
end
|
BIN
f77_zmq/examples/ventserver
Executable file
BIN
f77_zmq/examples/ventserver
Executable file
Binary file not shown.
51
f77_zmq/examples/ventserver.f
Normal file
51
f77_zmq/examples/ventserver.f
Normal file
@ -0,0 +1,51 @@
|
||||
program task_ventilator
|
||||
! Task ventilator
|
||||
! Binds PUSH socket to tcp://localhost:5557
|
||||
! Sends batch of tasks to workers via that socket
|
||||
implicit none
|
||||
include 'f77_zmq.h'
|
||||
|
||||
integer(ZMQ_PTR) context
|
||||
integer(ZMQ_PTR) sender, sink
|
||||
integer rc
|
||||
integer task_nbr
|
||||
integer total_msec
|
||||
integer workload
|
||||
double precision r
|
||||
character*(10) string
|
||||
|
||||
context = f77_zmq_ctx_new()
|
||||
sender = f77_zmq_socket(context,ZMQ_PUSH)
|
||||
rc = f77_zmq_bind (sender, "tcp://*:5557")
|
||||
if (rc /= 0) stop 'Bind failed'
|
||||
|
||||
! Socket to send start of batch message on
|
||||
sink = f77_zmq_socket (context, ZMQ_PUSH)
|
||||
rc = f77_zmq_connect (sink, "tcp://localhost:5558")
|
||||
if (rc /= 0) stop 'Connect failed'
|
||||
|
||||
print *, 'Press Enter when the workers are ready:'
|
||||
read(*,*)
|
||||
print *, 'Sending tasks to workers…'
|
||||
|
||||
! The first message is "0" and signals start of batch
|
||||
rc = f77_zmq_send (sink, '0', 1, 0);
|
||||
if (rc /= 1) stop 'Send failed'
|
||||
|
||||
! Send 100 tasks
|
||||
total_msec = 0 ! Total expected cost in msecs
|
||||
do task_nbr=1,100
|
||||
! Random workload from 1 to 100msecs
|
||||
call random_number(r)
|
||||
workload = int(100.*r) + 1
|
||||
total_msec = total_msec + workload
|
||||
write(string,'(I8)') workload
|
||||
print '(A)', string
|
||||
rc = f77_zmq_send(sender,string,len(trim(string)),0)
|
||||
enddo
|
||||
print *, 'Total expected cost: ',total_msec,' msec'
|
||||
|
||||
rc = f77_zmq_close (sink)
|
||||
rc = f77_zmq_close (sender)
|
||||
rc = f77_zmq_ctx_destroy (context)
|
||||
end
|
8
f77_zmq/examples/wu.sh
Executable file
8
f77_zmq/examples/wu.sh
Executable file
@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
source shell_functions.sh
|
||||
|
||||
SERVER=./wuserver
|
||||
CLIENT=./wuclient
|
||||
|
||||
run
|
BIN
f77_zmq/examples/wuclient
Executable file
BIN
f77_zmq/examples/wuclient
Executable file
Binary file not shown.
46
f77_zmq/examples/wuclient.f
Normal file
46
f77_zmq/examples/wuclient.f
Normal file
@ -0,0 +1,46 @@
|
||||
program wuclient
|
||||
implicit none
|
||||
include 'f77_zmq.h'
|
||||
|
||||
integer(ZMQ_PTR) context
|
||||
integer(ZMQ_PTR) subscriber
|
||||
integer rc
|
||||
integer zipcode, temperature, relhumidity
|
||||
double precision r
|
||||
character*(20) filter
|
||||
integer update_nbr
|
||||
integer iargc
|
||||
character*(40) string
|
||||
integer*8 total_temp
|
||||
|
||||
! Socket to talk to server
|
||||
print *, 'Collecting updates from weather server…'
|
||||
context = f77_zmq_ctx_new()
|
||||
subscriber = f77_zmq_socket (context, ZMQ_SUB)
|
||||
rc = f77_zmq_connect (subscriber, "tcp://localhost:5556")
|
||||
if (rc /= 0) stop 'Connect failed'
|
||||
|
||||
if (iargc() > 1) then
|
||||
call getarg(1,filter)
|
||||
else
|
||||
filter = '10001 '
|
||||
endif
|
||||
|
||||
rc = f77_zmq_setsockopt (subscriber, ZMQ_SUBSCRIBE,
|
||||
& filter, 6)
|
||||
if (rc /= 0) stop 'set_sockopt failed'
|
||||
|
||||
! Process 100 updates
|
||||
total_temp = 0_8
|
||||
do update_nbr=1,100
|
||||
rc = f77_zmq_recv (subscriber, string, 40, 0);
|
||||
print '(A)', string(1:rc)
|
||||
read(string(1:rc),*) zipcode, temperature, relhumidity
|
||||
total_temp = total_temp + temperature
|
||||
enddo
|
||||
print *, 'Average temperature for zipcode "'//trim(filter)//
|
||||
& '" was ', int(total_temp/100.), "F"
|
||||
rc = f77_zmq_close(subscriber)
|
||||
rc = f77_zmq_ctx_destroy(context)
|
||||
|
||||
end
|
BIN
f77_zmq/examples/wuserver
Executable file
BIN
f77_zmq/examples/wuserver
Executable file
Binary file not shown.
38
f77_zmq/examples/wuserver.f
Normal file
38
f77_zmq/examples/wuserver.f
Normal file
@ -0,0 +1,38 @@
|
||||
program wuserver
|
||||
implicit none
|
||||
include 'f77_zmq.h'
|
||||
|
||||
integer(ZMQ_PTR) context
|
||||
integer(ZMQ_PTR) publisher
|
||||
integer rc
|
||||
integer zipcode, temperature, relhumidity
|
||||
double precision r
|
||||
character*(20) update
|
||||
|
||||
context = f77_zmq_ctx_new()
|
||||
publisher = f77_zmq_socket (context, ZMQ_PUB)
|
||||
rc = f77_zmq_bind (publisher, "tcp://*:5556")
|
||||
if (rc /= 0) stop '1st Bind failed'
|
||||
|
||||
rc = f77_zmq_bind (publisher, "ipc://weather.ipc")
|
||||
if (rc /= 0) stop '2nd Bind failed'
|
||||
|
||||
do
|
||||
! Get values that will fool the boss
|
||||
call random_number(r)
|
||||
zipcode = int(r*100000)
|
||||
call random_number(r)
|
||||
temperature = int(r*215)-80
|
||||
call random_number(r)
|
||||
relhumidity = int(r*50)-10
|
||||
|
||||
! Send message to all subscribers
|
||||
write(update,'(I5.5,X,I4,X,I4)')
|
||||
& zipcode, temperature, relhumidity
|
||||
rc = f77_zmq_send (publisher, update, len(update), 0);
|
||||
|
||||
enddo
|
||||
rc = f77_zmq_close(publisher)
|
||||
rc = f77_zmq_ctx_destroy(context)
|
||||
|
||||
end
|
386
f77_zmq/f77_zmq.c
Normal file
386
f77_zmq/f77_zmq.c
Normal file
@ -0,0 +1,386 @@
|
||||
/*
|
||||
f77_zmq : Fortran 77 bindings for the ZeroMQ library
|
||||
Copyright (C) 2014 Anthony Scemama
|
||||
|
||||
|
||||
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
USA
|
||||
|
||||
Anthony Scemama <scemama@irsamc.ups-tlse.fr>
|
||||
Laboratoire de Chimie et Physique Quantiques - UMR5626
|
||||
Université Paul Sabatier - Bat. 3R1b4, 118 route de Narbonne
|
||||
31062 Toulouse Cedex 09, France
|
||||
*/
|
||||
|
||||
#include "zmq.h"
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
|
||||
/* Guidelines
|
||||
* ==========
|
||||
*
|
||||
* + Fortran-callable function names should start with f77_zmq_ and should end with an underscore.
|
||||
* + A space should be present between the the name of the function and the '(' character for the
|
||||
* python script to work properly.
|
||||
* + void* return types will be translated to INTEGER(ZMQ_PTR)
|
||||
* + int return types will be translated to INTEGER
|
||||
*
|
||||
*/
|
||||
|
||||
/* Helper functions *
|
||||
* ================ */
|
||||
|
||||
int f77_zmq_errno_ (void)
|
||||
{
|
||||
return zmq_errno ();
|
||||
}
|
||||
|
||||
char* f77_zmq_strerror_ (int *errnum)
|
||||
{
|
||||
return (char*) zmq_strerror (*errnum);
|
||||
};
|
||||
|
||||
void f77_zmq_version_ (int *major, int *minor, int *patch)
|
||||
{
|
||||
zmq_version (major, minor, patch);
|
||||
}
|
||||
|
||||
|
||||
/* Context *
|
||||
* ======= */
|
||||
|
||||
void* f77_zmq_ctx_new_ ()
|
||||
{
|
||||
return zmq_ctx_new ();
|
||||
}
|
||||
|
||||
int f77_zmq_ctx_destroy_ (void* *context)
|
||||
{
|
||||
return zmq_ctx_destroy (*context);
|
||||
}
|
||||
|
||||
int f77_zmq_ctx_term_ (void* *context)
|
||||
{
|
||||
return zmq_ctx_term (*context);
|
||||
}
|
||||
|
||||
int f77_zmq_ctx_shutdown_ (void* *context)
|
||||
{
|
||||
return zmq_ctx_shutdown (*context);
|
||||
}
|
||||
|
||||
int f77_zmq_ctx_set_ (void* *context, int* option_name, int* option_value)
|
||||
{
|
||||
return zmq_ctx_set (*context, *option_name, *option_value);
|
||||
}
|
||||
|
||||
|
||||
/* Sockets *
|
||||
* ======= */
|
||||
|
||||
void* f77_zmq_socket_ (void* *context, int* type)
|
||||
{
|
||||
return zmq_socket (*context, *type);
|
||||
}
|
||||
|
||||
int f77_zmq_close_ (void* *socket)
|
||||
{
|
||||
return zmq_close(*socket);
|
||||
}
|
||||
|
||||
int f77_zmq_bind_ (void* *socket, char* address_in, int address_len)
|
||||
{
|
||||
char* address = (char*) malloc(sizeof(char)*(address_len+1));
|
||||
int rc;
|
||||
int i;
|
||||
for (i=0 ; i<address_len ; i++)
|
||||
{
|
||||
address[i] = address_in[i];
|
||||
}
|
||||
address[address_len] = 0;
|
||||
rc = zmq_bind (*socket, address);
|
||||
free(address);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int f77_zmq_unbind_ (void* *socket, char* endpoint, int dummy)
|
||||
{
|
||||
return zmq_unbind(*socket, endpoint);
|
||||
}
|
||||
|
||||
|
||||
int f77_zmq_connect_ (void* *socket, char* address_in, int address_len)
|
||||
{
|
||||
char* address = (char*) malloc(sizeof(char)*(address_len+1));
|
||||
int rc;
|
||||
int i;
|
||||
for (i=0 ; i<address_len ; i++)
|
||||
{
|
||||
address[i] = address_in[i];
|
||||
}
|
||||
address[address_len] = 0;
|
||||
rc = zmq_connect (*socket, address);
|
||||
free(address);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int f77_zmq_disconnect_ (void* *socket, char* address, int dummy)
|
||||
{
|
||||
return zmq_disconnect(*socket,address);
|
||||
}
|
||||
|
||||
|
||||
int f77_zmq_setsockopt_ (void* *socket, int* option_name, void* option_value, int* option_len, int dummy)
|
||||
{
|
||||
return zmq_setsockopt (*socket, *option_name, option_value, *option_len);
|
||||
}
|
||||
|
||||
int f77_zmq_getsockopt_ (void* *socket, int* option_name, void *option_value, int *option_len, int dummy)
|
||||
{
|
||||
size_t option_len_st = (size_t) *option_len;
|
||||
return zmq_getsockopt (*socket, *option_name, option_value, &option_len_st);
|
||||
*option_len = option_len_st;
|
||||
}
|
||||
|
||||
int f77_zmq_socket_monitor_ (void* *socket, char* address, int* events, int dummy)
|
||||
{
|
||||
return zmq_socket_monitor(*socket,address,*events);
|
||||
}
|
||||
|
||||
/* Send/Recv *
|
||||
* ========= */
|
||||
|
||||
int f77_zmq_send_ (void* *socket, void* message, int* message_len, int* flags, int dummy)
|
||||
{
|
||||
return zmq_send (*socket, message, *message_len, *flags);
|
||||
}
|
||||
|
||||
int f77_zmq_recv_ (void* *socket, void* message, int* message_len, int* flags, int dummy)
|
||||
{
|
||||
return zmq_recv (*socket, message, *message_len, *flags);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Messages *
|
||||
* ======== */
|
||||
|
||||
void* f77_zmq_msg_new_ ()
|
||||
{
|
||||
return malloc (sizeof(zmq_msg_t));
|
||||
}
|
||||
|
||||
int f77_zmq_msg_destroy_ (zmq_msg_t* *msg)
|
||||
{
|
||||
if (*msg != NULL)
|
||||
{
|
||||
free(*msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* f77_zmq_msg_data_new_ (int* size_in, void* buffer, int* size_buffer, int dummy)
|
||||
{
|
||||
int i;
|
||||
void* data = malloc(*size_in * sizeof(char));
|
||||
if (*size_buffer > 0)
|
||||
memcpy(data,buffer,*size_buffer);
|
||||
return data;
|
||||
}
|
||||
|
||||
int f77_zmq_msg_destroy_data_ (void* *data)
|
||||
{
|
||||
if (*data != NULL)
|
||||
{
|
||||
free(*data);
|
||||
data = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int f77_zmq_msg_init_ (zmq_msg_t* *msg)
|
||||
{
|
||||
return zmq_msg_init (*msg);
|
||||
}
|
||||
|
||||
|
||||
int f77_zmq_msg_close_ (zmq_msg_t* *msg)
|
||||
{
|
||||
return zmq_msg_close (*msg);
|
||||
}
|
||||
|
||||
|
||||
int f77_zmq_msg_init_size_ (zmq_msg_t* *msg, int* size_in)
|
||||
{
|
||||
size_t size = (size_t) *size_in;
|
||||
return zmq_msg_init_size (*msg, size);
|
||||
}
|
||||
|
||||
|
||||
void ffn(void* data, void* hint)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
|
||||
int f77_zmq_msg_init_data_ (zmq_msg_t* *msg, void* *data, int* size_in)
|
||||
{
|
||||
size_t size = (size_t) *size_in;
|
||||
return zmq_msg_init_data (*msg, *data, size, &ffn, NULL);
|
||||
}
|
||||
|
||||
|
||||
int f77_zmq_msg_send_ (zmq_msg_t* *msg, void* *socket, int* flags)
|
||||
{
|
||||
return zmq_msg_send (*msg, *socket, *flags);
|
||||
}
|
||||
|
||||
|
||||
int f77_zmq_msg_recv_ (zmq_msg_t* *msg, void* *socket, int* flags)
|
||||
{
|
||||
return zmq_msg_recv (*msg, *socket, *flags);
|
||||
}
|
||||
|
||||
|
||||
void* f77_zmq_msg_data_ (zmq_msg_t* *msg)
|
||||
{
|
||||
return zmq_msg_data(*msg);
|
||||
}
|
||||
|
||||
|
||||
int f77_zmq_msg_size_ (zmq_msg_t* *msg)
|
||||
{
|
||||
const size_t rc = zmq_msg_size (*msg);
|
||||
return (int) rc;
|
||||
}
|
||||
|
||||
|
||||
int f77_zmq_msg_copy_from_data_ (zmq_msg_t* *msg, void* buffer, int dummy)
|
||||
{
|
||||
const size_t sze = zmq_msg_size (*msg);
|
||||
void* data = zmq_msg_data (*msg);
|
||||
memcpy(buffer,data,sze*sizeof(char));
|
||||
return (int) sze;
|
||||
}
|
||||
|
||||
int f77_zmq_msg_copy_to_data_ (zmq_msg_t* *msg, void* buffer, int* size_in, int dummy)
|
||||
{
|
||||
const size_t size = (size_t) *size_in;
|
||||
void* data = zmq_msg_data (*msg);
|
||||
memcpy(data,buffer,size*sizeof(char));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int f77_zmq_msg_more_ (zmq_msg_t* *message)
|
||||
{
|
||||
return zmq_msg_more (*message);
|
||||
}
|
||||
|
||||
|
||||
int f77_zmq_msg_get_ (zmq_msg_t* *message, int *property)
|
||||
{
|
||||
return zmq_msg_get (*message, *property);
|
||||
}
|
||||
|
||||
|
||||
int f77_zmq_msg_set_ (zmq_msg_t* *message, int *property, int *value)
|
||||
{
|
||||
return zmq_msg_set (*message, *property, *value);
|
||||
}
|
||||
|
||||
|
||||
int f77_zmq_msg_copy_ (zmq_msg_t* *dest, zmq_msg_t* *src)
|
||||
{
|
||||
return zmq_msg_copy (*dest, *src);
|
||||
}
|
||||
|
||||
|
||||
int f77_zmq_msg_move_ (zmq_msg_t* *dest, zmq_msg_t* *src)
|
||||
{
|
||||
return zmq_msg_move (*dest, *src);
|
||||
}
|
||||
|
||||
|
||||
/* Polling *
|
||||
* ======= */
|
||||
|
||||
int f77_zmq_poll_ (zmq_pollitem_t *items, int *nitems, long *timeout)
|
||||
{
|
||||
return zmq_poll (items, *nitems, *timeout);
|
||||
}
|
||||
|
||||
|
||||
void* f77_zmq_pollitem_new_ ()
|
||||
{
|
||||
return malloc (sizeof(zmq_pollitem_t));
|
||||
}
|
||||
|
||||
|
||||
int f77_zmq_pollitem_destroy_ (zmq_pollitem_t* *item)
|
||||
{
|
||||
if (*item != NULL)
|
||||
{
|
||||
free(*item);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int f77_zmq_proxy_ (void* *frontend, void* *backend, void* *capture)
|
||||
{
|
||||
return zmq_proxy(*frontend, *backend, *capture);
|
||||
}
|
||||
|
||||
|
||||
/* Events *
|
||||
* ====== */
|
||||
|
||||
void* f77_zmq_event_new_ ()
|
||||
{
|
||||
return malloc (sizeof(zmq_event_t));
|
||||
}
|
||||
|
||||
|
||||
int f77_zmq_event_destroy_ (zmq_event_t* *event)
|
||||
{
|
||||
if (*event != NULL)
|
||||
{
|
||||
free(*event);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int f77_zmq_event_event_ (zmq_event_t* *event)
|
||||
{
|
||||
return (int) (*event)->event;
|
||||
}
|
||||
|
||||
int f77_zmq_event_set_event_ (zmq_event_t* *event, int* bitfield)
|
||||
{
|
||||
(*event)->event = (uint16_t) *bitfield;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int f77_zmq_event_value_ (zmq_event_t* *event)
|
||||
{
|
||||
return (int) (*event)->value;
|
||||
}
|
||||
|
||||
int f77_zmq_event_set_value_ (zmq_event_t* *event, int* value)
|
||||
{
|
||||
(*event)->value = (uint32_t) *value;
|
||||
return 0;
|
||||
}
|
||||
|
338
f77_zmq/f77_zmq.h
Normal file
338
f77_zmq/f77_zmq.h
Normal file
@ -0,0 +1,338 @@
|
||||
integer EADDRINUSE
|
||||
integer EADDRNOTAVAIL
|
||||
integer EAFNOSUPPORT
|
||||
integer ECONNABORTED
|
||||
integer ECONNREFUSED
|
||||
integer ECONNRESET
|
||||
integer EFSM
|
||||
integer EHOSTUNREACH
|
||||
integer EINPROGRESS
|
||||
integer EMSGSIZE
|
||||
integer EMTHREAD
|
||||
integer ENETDOWN
|
||||
integer ENETRESET
|
||||
integer ENETUNREACH
|
||||
integer ENOBUFS
|
||||
integer ENOCOMPATPROTO
|
||||
integer ENOTCONN
|
||||
integer ENOTSOCK
|
||||
integer ENOTSUP
|
||||
integer EPROTONOSUPPORT
|
||||
integer ETERM
|
||||
integer ETIMEDOUT
|
||||
integer ZMQ_AFFINITY
|
||||
integer ZMQ_BACKLOG
|
||||
integer ZMQ_CONFLATE
|
||||
integer ZMQ_CURVE
|
||||
integer ZMQ_CURVE_PUBLICKEY
|
||||
integer ZMQ_CURVE_SECRETKEY
|
||||
integer ZMQ_CURVE_SERVER
|
||||
integer ZMQ_CURVE_SERVERKEY
|
||||
integer ZMQ_DEALER
|
||||
integer ZMQ_DELAY_ATTACH_ON_CONNECT
|
||||
integer ZMQ_DONTWAIT
|
||||
integer ZMQ_EVENTS
|
||||
integer ZMQ_EVENT_ACCEPTED
|
||||
integer ZMQ_EVENT_ACCEPT_FAILED
|
||||
integer ZMQ_EVENT_ALL
|
||||
integer ZMQ_EVENT_BIND_FAILED
|
||||
integer ZMQ_EVENT_CLOSED
|
||||
integer ZMQ_EVENT_CLOSE_FAILED
|
||||
integer ZMQ_EVENT_CONNECTED
|
||||
integer ZMQ_EVENT_CONNECT_DELAYED
|
||||
integer ZMQ_EVENT_CONNECT_RETRIED
|
||||
integer ZMQ_EVENT_DISCONNECTED
|
||||
integer ZMQ_EVENT_LISTENING
|
||||
integer ZMQ_EVENT_MONITOR_STOPPED
|
||||
integer ZMQ_FAIL_UNROUTABLE
|
||||
integer ZMQ_FD
|
||||
integer ZMQ_FORWARDER
|
||||
integer ZMQ_HAUSNUMERO
|
||||
integer ZMQ_IDENTITY
|
||||
integer ZMQ_IMMEDIATE
|
||||
integer ZMQ_IO_THREADS
|
||||
integer ZMQ_IO_THREADS_DFLT
|
||||
integer ZMQ_IPV4ONLY
|
||||
integer ZMQ_IPV6
|
||||
integer ZMQ_LAST_ENDPOINT
|
||||
integer ZMQ_LINGER
|
||||
integer ZMQ_MAXMSGSIZE
|
||||
integer ZMQ_MAX_SOCKETS
|
||||
integer ZMQ_MAX_SOCKETS_DFLT
|
||||
integer ZMQ_MECHANISM
|
||||
integer ZMQ_MORE
|
||||
integer ZMQ_MULTICAST_HOPS
|
||||
integer ZMQ_NOBLOCK
|
||||
integer ZMQ_NULL
|
||||
integer ZMQ_PAIR
|
||||
integer ZMQ_PLAIN
|
||||
integer ZMQ_PLAIN_PASSWORD
|
||||
integer ZMQ_PLAIN_SERVER
|
||||
integer ZMQ_PLAIN_USERNAME
|
||||
integer ZMQ_POLLERR
|
||||
integer ZMQ_POLLIN
|
||||
integer ZMQ_POLLITEMS_DFLT
|
||||
integer ZMQ_POLLOUT
|
||||
integer ZMQ_PROBE_ROUTER
|
||||
integer ZMQ_PTR
|
||||
integer ZMQ_PUB
|
||||
integer ZMQ_PULL
|
||||
integer ZMQ_PUSH
|
||||
integer ZMQ_QUEUE
|
||||
integer ZMQ_RATE
|
||||
integer ZMQ_RCVBUF
|
||||
integer ZMQ_RCVHWM
|
||||
integer ZMQ_RCVMORE
|
||||
integer ZMQ_RCVTIMEO
|
||||
integer ZMQ_RECONNECT_IVL
|
||||
integer ZMQ_RECONNECT_IVL_MAX
|
||||
integer ZMQ_RECOVERY_IVL
|
||||
integer ZMQ_REP
|
||||
integer ZMQ_REQ
|
||||
integer ZMQ_REQ_CORRELATE
|
||||
integer ZMQ_REQ_RELAXED
|
||||
integer ZMQ_ROUTER
|
||||
integer ZMQ_ROUTER_BEHAVIOR
|
||||
integer ZMQ_ROUTER_MANDATORY
|
||||
integer ZMQ_ROUTER_RAW
|
||||
integer ZMQ_SNDBUF
|
||||
integer ZMQ_SNDHWM
|
||||
integer ZMQ_SNDMORE
|
||||
integer ZMQ_SNDTIMEO
|
||||
integer ZMQ_STREAM
|
||||
integer ZMQ_STREAMER
|
||||
integer ZMQ_SUB
|
||||
integer ZMQ_SUBSCRIBE
|
||||
integer ZMQ_TCP_ACCEPT_FILTER
|
||||
integer ZMQ_TCP_KEEPALIVE
|
||||
integer ZMQ_TCP_KEEPALIVE_CNT
|
||||
integer ZMQ_TCP_KEEPALIVE_IDLE
|
||||
integer ZMQ_TCP_KEEPALIVE_INTVL
|
||||
integer ZMQ_TYPE
|
||||
integer ZMQ_UNSUBSCRIBE
|
||||
integer ZMQ_VERSION
|
||||
integer ZMQ_VERSION_MAJOR
|
||||
integer ZMQ_VERSION_MINOR
|
||||
integer ZMQ_VERSION_PATCH
|
||||
integer ZMQ_XPUB
|
||||
integer ZMQ_XPUB_VERBOSE
|
||||
integer ZMQ_XREP
|
||||
integer ZMQ_XREQ
|
||||
integer ZMQ_XSUB
|
||||
integer ZMQ_ZAP_DOMAIN
|
||||
parameter ( EADDRINUSE = 156384717 )
|
||||
parameter ( EADDRNOTAVAIL = 156384718 )
|
||||
parameter ( EAFNOSUPPORT = 156384723 )
|
||||
parameter ( ECONNABORTED = 156384725 )
|
||||
parameter ( ECONNREFUSED = 156384719 )
|
||||
parameter ( ECONNRESET = 156384726 )
|
||||
parameter ( EFSM = 156384763 )
|
||||
parameter ( EHOSTUNREACH = 156384729 )
|
||||
parameter ( EINPROGRESS = 156384720 )
|
||||
parameter ( EMSGSIZE = 156384722 )
|
||||
parameter ( EMTHREAD = 156384766 )
|
||||
parameter ( ENETDOWN = 156384716 )
|
||||
parameter ( ENETRESET = 156384730 )
|
||||
parameter ( ENETUNREACH = 156384724 )
|
||||
parameter ( ENOBUFS = 156384715 )
|
||||
parameter ( ENOCOMPATPROTO = 156384764 )
|
||||
parameter ( ENOTCONN = 156384727 )
|
||||
parameter ( ENOTSOCK = 156384721 )
|
||||
parameter ( ENOTSUP = 156384713 )
|
||||
parameter ( EPROTONOSUPPORT = 156384714 )
|
||||
parameter ( ETERM = 156384765 )
|
||||
parameter ( ETIMEDOUT = 156384728 )
|
||||
parameter ( ZMQ_AFFINITY = 4 )
|
||||
parameter ( ZMQ_BACKLOG = 19 )
|
||||
parameter ( ZMQ_CONFLATE = 54 )
|
||||
parameter ( ZMQ_CURVE = 2 )
|
||||
parameter ( ZMQ_CURVE_PUBLICKEY = 48 )
|
||||
parameter ( ZMQ_CURVE_SECRETKEY = 49 )
|
||||
parameter ( ZMQ_CURVE_SERVER = 47 )
|
||||
parameter ( ZMQ_CURVE_SERVERKEY = 50 )
|
||||
parameter ( ZMQ_DEALER = 5 )
|
||||
parameter ( ZMQ_DELAY_ATTACH_ON_CONNECT = 39 )
|
||||
parameter ( ZMQ_DONTWAIT = 1 )
|
||||
parameter ( ZMQ_EVENTS = 15 )
|
||||
parameter ( ZMQ_EVENT_ACCEPTED = 32 )
|
||||
parameter ( ZMQ_EVENT_ACCEPT_FAILED = 64 )
|
||||
parameter ( ZMQ_EVENT_ALL = 2047 )
|
||||
parameter ( ZMQ_EVENT_BIND_FAILED = 16 )
|
||||
parameter ( ZMQ_EVENT_CLOSED = 128 )
|
||||
parameter ( ZMQ_EVENT_CLOSE_FAILED = 256 )
|
||||
parameter ( ZMQ_EVENT_CONNECTED = 1 )
|
||||
parameter ( ZMQ_EVENT_CONNECT_DELAYED = 2 )
|
||||
parameter ( ZMQ_EVENT_CONNECT_RETRIED = 4 )
|
||||
parameter ( ZMQ_EVENT_DISCONNECTED = 512 )
|
||||
parameter ( ZMQ_EVENT_LISTENING = 8 )
|
||||
parameter ( ZMQ_EVENT_MONITOR_STOPPED = 1024 )
|
||||
parameter ( ZMQ_FAIL_UNROUTABLE = 33 )
|
||||
parameter ( ZMQ_FD = 14 )
|
||||
parameter ( ZMQ_FORWARDER = 2 )
|
||||
parameter ( ZMQ_HAUSNUMERO = 156384712 )
|
||||
parameter ( ZMQ_IDENTITY = 5 )
|
||||
parameter ( ZMQ_IMMEDIATE = 39 )
|
||||
parameter ( ZMQ_IO_THREADS = 1 )
|
||||
parameter ( ZMQ_IO_THREADS_DFLT = 1 )
|
||||
parameter ( ZMQ_IPV4ONLY = 31 )
|
||||
parameter ( ZMQ_IPV6 = 42 )
|
||||
parameter ( ZMQ_LAST_ENDPOINT = 32 )
|
||||
parameter ( ZMQ_LINGER = 17 )
|
||||
parameter ( ZMQ_MAXMSGSIZE = 22 )
|
||||
parameter ( ZMQ_MAX_SOCKETS = 2 )
|
||||
parameter ( ZMQ_MAX_SOCKETS_DFLT = 1023 )
|
||||
parameter ( ZMQ_MECHANISM = 43 )
|
||||
parameter ( ZMQ_MORE = 1 )
|
||||
parameter ( ZMQ_MULTICAST_HOPS = 25 )
|
||||
parameter ( ZMQ_NOBLOCK = 1 )
|
||||
parameter ( ZMQ_NULL = 0 )
|
||||
parameter ( ZMQ_PAIR = 0 )
|
||||
parameter ( ZMQ_PLAIN = 1 )
|
||||
parameter ( ZMQ_PLAIN_PASSWORD = 46 )
|
||||
parameter ( ZMQ_PLAIN_SERVER = 44 )
|
||||
parameter ( ZMQ_PLAIN_USERNAME = 45 )
|
||||
parameter ( ZMQ_POLLERR = 4 )
|
||||
parameter ( ZMQ_POLLIN = 1 )
|
||||
parameter ( ZMQ_POLLITEMS_DFLT = 16 )
|
||||
parameter ( ZMQ_POLLOUT = 2 )
|
||||
parameter ( ZMQ_PROBE_ROUTER = 51 )
|
||||
parameter ( ZMQ_PTR = 8 )
|
||||
parameter ( ZMQ_PUB = 1 )
|
||||
parameter ( ZMQ_PULL = 7 )
|
||||
parameter ( ZMQ_PUSH = 8 )
|
||||
parameter ( ZMQ_QUEUE = 3 )
|
||||
parameter ( ZMQ_RATE = 8 )
|
||||
parameter ( ZMQ_RCVBUF = 12 )
|
||||
parameter ( ZMQ_RCVHWM = 24 )
|
||||
parameter ( ZMQ_RCVMORE = 13 )
|
||||
parameter ( ZMQ_RCVTIMEO = 27 )
|
||||
parameter ( ZMQ_RECONNECT_IVL = 18 )
|
||||
parameter ( ZMQ_RECONNECT_IVL_MAX = 21 )
|
||||
parameter ( ZMQ_RECOVERY_IVL = 9 )
|
||||
parameter ( ZMQ_REP = 4 )
|
||||
parameter ( ZMQ_REQ = 3 )
|
||||
parameter ( ZMQ_REQ_CORRELATE = 52 )
|
||||
parameter ( ZMQ_REQ_RELAXED = 53 )
|
||||
parameter ( ZMQ_ROUTER = 6 )
|
||||
parameter ( ZMQ_ROUTER_BEHAVIOR = 33 )
|
||||
parameter ( ZMQ_ROUTER_MANDATORY = 33 )
|
||||
parameter ( ZMQ_ROUTER_RAW = 41 )
|
||||
parameter ( ZMQ_SNDBUF = 11 )
|
||||
parameter ( ZMQ_SNDHWM = 23 )
|
||||
parameter ( ZMQ_SNDMORE = 2 )
|
||||
parameter ( ZMQ_SNDTIMEO = 28 )
|
||||
parameter ( ZMQ_STREAM = 11 )
|
||||
parameter ( ZMQ_STREAMER = 1 )
|
||||
parameter ( ZMQ_SUB = 2 )
|
||||
parameter ( ZMQ_SUBSCRIBE = 6 )
|
||||
parameter ( ZMQ_TCP_ACCEPT_FILTER = 38 )
|
||||
parameter ( ZMQ_TCP_KEEPALIVE = 34 )
|
||||
parameter ( ZMQ_TCP_KEEPALIVE_CNT = 35 )
|
||||
parameter ( ZMQ_TCP_KEEPALIVE_IDLE = 36 )
|
||||
parameter ( ZMQ_TCP_KEEPALIVE_INTVL = 37 )
|
||||
parameter ( ZMQ_TYPE = 16 )
|
||||
parameter ( ZMQ_UNSUBSCRIBE = 7 )
|
||||
parameter ( ZMQ_VERSION = 40005 )
|
||||
parameter ( ZMQ_VERSION_MAJOR = 4 )
|
||||
parameter ( ZMQ_VERSION_MINOR = 0 )
|
||||
parameter ( ZMQ_VERSION_PATCH = 5 )
|
||||
parameter ( ZMQ_XPUB = 9 )
|
||||
parameter ( ZMQ_XPUB_VERBOSE = 40 )
|
||||
parameter ( ZMQ_XREP = 6 )
|
||||
parameter ( ZMQ_XREQ = 5 )
|
||||
parameter ( ZMQ_XSUB = 10 )
|
||||
parameter ( ZMQ_ZAP_DOMAIN = 55 )
|
||||
integer f77_zmq_bind
|
||||
external f77_zmq_bind
|
||||
integer f77_zmq_close
|
||||
external f77_zmq_close
|
||||
integer f77_zmq_connect
|
||||
external f77_zmq_connect
|
||||
integer f77_zmq_ctx_destroy
|
||||
external f77_zmq_ctx_destroy
|
||||
integer*8 f77_zmq_ctx_new
|
||||
external f77_zmq_ctx_new
|
||||
integer f77_zmq_ctx_set
|
||||
external f77_zmq_ctx_set
|
||||
integer f77_zmq_ctx_shutdown
|
||||
external f77_zmq_ctx_shutdown
|
||||
integer f77_zmq_ctx_term
|
||||
external f77_zmq_ctx_term
|
||||
integer f77_zmq_disconnect
|
||||
external f77_zmq_disconnect
|
||||
integer f77_zmq_errno
|
||||
external f77_zmq_errno
|
||||
integer f77_zmq_event_destroy
|
||||
external f77_zmq_event_destroy
|
||||
integer f77_zmq_event_event
|
||||
external f77_zmq_event_event
|
||||
integer*8 f77_zmq_event_new
|
||||
external f77_zmq_event_new
|
||||
integer f77_zmq_event_set_event
|
||||
external f77_zmq_event_set_event
|
||||
integer f77_zmq_event_set_value
|
||||
external f77_zmq_event_set_value
|
||||
integer f77_zmq_event_value
|
||||
external f77_zmq_event_value
|
||||
integer f77_zmq_getsockopt
|
||||
external f77_zmq_getsockopt
|
||||
integer f77_zmq_msg_close
|
||||
external f77_zmq_msg_close
|
||||
integer f77_zmq_msg_copy
|
||||
external f77_zmq_msg_copy
|
||||
integer f77_zmq_msg_copy_from_data
|
||||
external f77_zmq_msg_copy_from_data
|
||||
integer f77_zmq_msg_copy_to_data
|
||||
external f77_zmq_msg_copy_to_data
|
||||
integer*8 f77_zmq_msg_data
|
||||
external f77_zmq_msg_data
|
||||
integer*8 f77_zmq_msg_data_new
|
||||
external f77_zmq_msg_data_new
|
||||
integer f77_zmq_msg_destroy
|
||||
external f77_zmq_msg_destroy
|
||||
integer f77_zmq_msg_destroy_data
|
||||
external f77_zmq_msg_destroy_data
|
||||
integer f77_zmq_msg_get
|
||||
external f77_zmq_msg_get
|
||||
integer f77_zmq_msg_init
|
||||
external f77_zmq_msg_init
|
||||
integer f77_zmq_msg_init_data
|
||||
external f77_zmq_msg_init_data
|
||||
integer f77_zmq_msg_init_size
|
||||
external f77_zmq_msg_init_size
|
||||
integer f77_zmq_msg_more
|
||||
external f77_zmq_msg_more
|
||||
integer f77_zmq_msg_move
|
||||
external f77_zmq_msg_move
|
||||
integer*8 f77_zmq_msg_new
|
||||
external f77_zmq_msg_new
|
||||
integer f77_zmq_msg_recv
|
||||
external f77_zmq_msg_recv
|
||||
integer f77_zmq_msg_send
|
||||
external f77_zmq_msg_send
|
||||
integer f77_zmq_msg_set
|
||||
external f77_zmq_msg_set
|
||||
integer f77_zmq_msg_size
|
||||
external f77_zmq_msg_size
|
||||
integer f77_zmq_poll
|
||||
external f77_zmq_poll
|
||||
integer f77_zmq_pollitem_destroy
|
||||
external f77_zmq_pollitem_destroy
|
||||
integer*8 f77_zmq_pollitem_new
|
||||
external f77_zmq_pollitem_new
|
||||
integer f77_zmq_proxy
|
||||
external f77_zmq_proxy
|
||||
integer f77_zmq_recv
|
||||
external f77_zmq_recv
|
||||
integer f77_zmq_send
|
||||
external f77_zmq_send
|
||||
integer f77_zmq_setsockopt
|
||||
external f77_zmq_setsockopt
|
||||
integer*8 f77_zmq_socket
|
||||
external f77_zmq_socket
|
||||
integer f77_zmq_socket_monitor
|
||||
external f77_zmq_socket_monitor
|
||||
character*(256) f77_zmq_strerror
|
||||
external f77_zmq_strerror
|
||||
integer f77_zmq_unbind
|
||||
external f77_zmq_unbind
|
417
f77_zmq/zmq.h
Normal file
417
f77_zmq/zmq.h
Normal file
@ -0,0 +1,417 @@
|
||||
/*
|
||||
Copyright (c) 2007-2013 Contributors as noted in the AUTHORS file
|
||||
|
||||
This file is part of 0MQ.
|
||||
|
||||
0MQ 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
0MQ is distributed in the hope that 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 program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*************************************************************************
|
||||
NOTE to contributors. This file comprises the principal public contract
|
||||
for ZeroMQ API users (along with zmq_utils.h). Any change to this file
|
||||
supplied in a stable release SHOULD not break existing applications.
|
||||
In practice this means that the value of constants must not change, and
|
||||
that old values may not be reused for new constants.
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __ZMQ_H_INCLUDED__
|
||||
#define __ZMQ_H_INCLUDED__
|
||||
|
||||
/* Version macros for compile-time API version detection */
|
||||
#define ZMQ_VERSION_MAJOR 4
|
||||
#define ZMQ_VERSION_MINOR 0
|
||||
#define ZMQ_VERSION_PATCH 5
|
||||
|
||||
#define ZMQ_MAKE_VERSION(major, minor, patch) \
|
||||
((major) * 10000 + (minor) * 100 + (patch))
|
||||
#define ZMQ_VERSION \
|
||||
ZMQ_MAKE_VERSION(ZMQ_VERSION_MAJOR, ZMQ_VERSION_MINOR, ZMQ_VERSION_PATCH)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if !defined _WIN32_WCE
|
||||
#include <errno.h>
|
||||
#endif
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#if defined _WIN32
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
/* Handle DSO symbol visibility */
|
||||
#if defined _WIN32
|
||||
# if defined ZMQ_STATIC
|
||||
# define ZMQ_EXPORT
|
||||
# elif defined DLL_EXPORT
|
||||
# define ZMQ_EXPORT __declspec(dllexport)
|
||||
# else
|
||||
# define ZMQ_EXPORT __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# if defined __SUNPRO_C || defined __SUNPRO_CC
|
||||
# define ZMQ_EXPORT __global
|
||||
# elif (defined __GNUC__ && __GNUC__ >= 4) || defined __INTEL_COMPILER
|
||||
# define ZMQ_EXPORT __attribute__ ((visibility("default")))
|
||||
# else
|
||||
# define ZMQ_EXPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Define integer types needed for event interface */
|
||||
#if defined ZMQ_HAVE_SOLARIS || defined ZMQ_HAVE_OPENVMS
|
||||
# include <inttypes.h>
|
||||
#elif defined _MSC_VER && _MSC_VER < 1600
|
||||
# ifndef int32_t
|
||||
typedef __int32 int32_t;
|
||||
# endif
|
||||
# ifndef uint16_t
|
||||
typedef unsigned __int16 uint16_t;
|
||||
# endif
|
||||
# ifndef uint8_t
|
||||
typedef unsigned __int8 uint8_t;
|
||||
# endif
|
||||
#else
|
||||
# include <stdint.h>
|
||||
#endif
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* 0MQ errors. */
|
||||
/******************************************************************************/
|
||||
|
||||
/* A number random enough not to collide with different errno ranges on */
|
||||
/* different OSes. The assumption is that error_t is at least 32-bit type. */
|
||||
#define ZMQ_HAUSNUMERO 156384712
|
||||
|
||||
/* On Windows platform some of the standard POSIX errnos are not defined. */
|
||||
#ifndef ENOTSUP
|
||||
#define ENOTSUP (ZMQ_HAUSNUMERO + 1)
|
||||
#endif
|
||||
#ifndef EPROTONOSUPPORT
|
||||
#define EPROTONOSUPPORT (ZMQ_HAUSNUMERO + 2)
|
||||
#endif
|
||||
#ifndef ENOBUFS
|
||||
#define ENOBUFS (ZMQ_HAUSNUMERO + 3)
|
||||
#endif
|
||||
#ifndef ENETDOWN
|
||||
#define ENETDOWN (ZMQ_HAUSNUMERO + 4)
|
||||
#endif
|
||||
#ifndef EADDRINUSE
|
||||
#define EADDRINUSE (ZMQ_HAUSNUMERO + 5)
|
||||
#endif
|
||||
#ifndef EADDRNOTAVAIL
|
||||
#define EADDRNOTAVAIL (ZMQ_HAUSNUMERO + 6)
|
||||
#endif
|
||||
#ifndef ECONNREFUSED
|
||||
#define ECONNREFUSED (ZMQ_HAUSNUMERO + 7)
|
||||
#endif
|
||||
#ifndef EINPROGRESS
|
||||
#define EINPROGRESS (ZMQ_HAUSNUMERO + 8)
|
||||
#endif
|
||||
#ifndef ENOTSOCK
|
||||
#define ENOTSOCK (ZMQ_HAUSNUMERO + 9)
|
||||
#endif
|
||||
#ifndef EMSGSIZE
|
||||
#define EMSGSIZE (ZMQ_HAUSNUMERO + 10)
|
||||
#endif
|
||||
#ifndef EAFNOSUPPORT
|
||||
#define EAFNOSUPPORT (ZMQ_HAUSNUMERO + 11)
|
||||
#endif
|
||||
#ifndef ENETUNREACH
|
||||
#define ENETUNREACH (ZMQ_HAUSNUMERO + 12)
|
||||
#endif
|
||||
#ifndef ECONNABORTED
|
||||
#define ECONNABORTED (ZMQ_HAUSNUMERO + 13)
|
||||
#endif
|
||||
#ifndef ECONNRESET
|
||||
#define ECONNRESET (ZMQ_HAUSNUMERO + 14)
|
||||
#endif
|
||||
#ifndef ENOTCONN
|
||||
#define ENOTCONN (ZMQ_HAUSNUMERO + 15)
|
||||
#endif
|
||||
#ifndef ETIMEDOUT
|
||||
#define ETIMEDOUT (ZMQ_HAUSNUMERO + 16)
|
||||
#endif
|
||||
#ifndef EHOSTUNREACH
|
||||
#define EHOSTUNREACH (ZMQ_HAUSNUMERO + 17)
|
||||
#endif
|
||||
#ifndef ENETRESET
|
||||
#define ENETRESET (ZMQ_HAUSNUMERO + 18)
|
||||
#endif
|
||||
|
||||
/* Native 0MQ error codes. */
|
||||
#define EFSM (ZMQ_HAUSNUMERO + 51)
|
||||
#define ENOCOMPATPROTO (ZMQ_HAUSNUMERO + 52)
|
||||
#define ETERM (ZMQ_HAUSNUMERO + 53)
|
||||
#define EMTHREAD (ZMQ_HAUSNUMERO + 54)
|
||||
|
||||
/* Run-time API version detection */
|
||||
ZMQ_EXPORT void zmq_version (int *major, int *minor, int *patch);
|
||||
|
||||
/* This function retrieves the errno as it is known to 0MQ library. The goal */
|
||||
/* of this function is to make the code 100% portable, including where 0MQ */
|
||||
/* compiled with certain CRT library (on Windows) is linked to an */
|
||||
/* application that uses different CRT library. */
|
||||
ZMQ_EXPORT int zmq_errno (void);
|
||||
|
||||
/* Resolves system errors and 0MQ errors to human-readable string. */
|
||||
ZMQ_EXPORT const char *zmq_strerror (int errnum);
|
||||
|
||||
/******************************************************************************/
|
||||
/* 0MQ infrastructure (a.k.a. context) initialisation & termination. */
|
||||
/******************************************************************************/
|
||||
|
||||
/* New API */
|
||||
/* Context options */
|
||||
#define ZMQ_IO_THREADS 1
|
||||
#define ZMQ_MAX_SOCKETS 2
|
||||
|
||||
/* Default for new contexts */
|
||||
#define ZMQ_IO_THREADS_DFLT 1
|
||||
#define ZMQ_MAX_SOCKETS_DFLT 1023
|
||||
|
||||
ZMQ_EXPORT void *zmq_ctx_new (void);
|
||||
ZMQ_EXPORT int zmq_ctx_term (void *context);
|
||||
ZMQ_EXPORT int zmq_ctx_shutdown (void *ctx_);
|
||||
ZMQ_EXPORT int zmq_ctx_set (void *context, int option, int optval);
|
||||
ZMQ_EXPORT int zmq_ctx_get (void *context, int option);
|
||||
|
||||
/* Old (legacy) API */
|
||||
ZMQ_EXPORT void *zmq_init (int io_threads);
|
||||
ZMQ_EXPORT int zmq_term (void *context);
|
||||
ZMQ_EXPORT int zmq_ctx_destroy (void *context);
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* 0MQ message definition. */
|
||||
/******************************************************************************/
|
||||
|
||||
typedef struct zmq_msg_t {unsigned char _ [32];} zmq_msg_t;
|
||||
|
||||
typedef void (zmq_free_fn) (void *data, void *hint);
|
||||
|
||||
ZMQ_EXPORT int zmq_msg_init (zmq_msg_t *msg);
|
||||
ZMQ_EXPORT int zmq_msg_init_size (zmq_msg_t *msg, size_t size);
|
||||
ZMQ_EXPORT int zmq_msg_init_data (zmq_msg_t *msg, void *data,
|
||||
size_t size, zmq_free_fn *ffn, void *hint);
|
||||
ZMQ_EXPORT int zmq_msg_send (zmq_msg_t *msg, void *s, int flags);
|
||||
ZMQ_EXPORT int zmq_msg_recv (zmq_msg_t *msg, void *s, int flags);
|
||||
ZMQ_EXPORT int zmq_msg_close (zmq_msg_t *msg);
|
||||
ZMQ_EXPORT int zmq_msg_move (zmq_msg_t *dest, zmq_msg_t *src);
|
||||
ZMQ_EXPORT int zmq_msg_copy (zmq_msg_t *dest, zmq_msg_t *src);
|
||||
ZMQ_EXPORT void *zmq_msg_data (zmq_msg_t *msg);
|
||||
ZMQ_EXPORT size_t zmq_msg_size (zmq_msg_t *msg);
|
||||
ZMQ_EXPORT int zmq_msg_more (zmq_msg_t *msg);
|
||||
ZMQ_EXPORT int zmq_msg_get (zmq_msg_t *msg, int option);
|
||||
ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg, int option, int optval);
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* 0MQ socket definition. */
|
||||
/******************************************************************************/
|
||||
|
||||
/* Socket types. */
|
||||
#define ZMQ_PAIR 0
|
||||
#define ZMQ_PUB 1
|
||||
#define ZMQ_SUB 2
|
||||
#define ZMQ_REQ 3
|
||||
#define ZMQ_REP 4
|
||||
#define ZMQ_DEALER 5
|
||||
#define ZMQ_ROUTER 6
|
||||
#define ZMQ_PULL 7
|
||||
#define ZMQ_PUSH 8
|
||||
#define ZMQ_XPUB 9
|
||||
#define ZMQ_XSUB 10
|
||||
#define ZMQ_STREAM 11
|
||||
|
||||
/* Deprecated aliases */
|
||||
#define ZMQ_XREQ ZMQ_DEALER
|
||||
#define ZMQ_XREP ZMQ_ROUTER
|
||||
|
||||
/* Socket options. */
|
||||
#define ZMQ_AFFINITY 4
|
||||
#define ZMQ_IDENTITY 5
|
||||
#define ZMQ_SUBSCRIBE 6
|
||||
#define ZMQ_UNSUBSCRIBE 7
|
||||
#define ZMQ_RATE 8
|
||||
#define ZMQ_RECOVERY_IVL 9
|
||||
#define ZMQ_SNDBUF 11
|
||||
#define ZMQ_RCVBUF 12
|
||||
#define ZMQ_RCVMORE 13
|
||||
#define ZMQ_FD 14
|
||||
#define ZMQ_EVENTS 15
|
||||
#define ZMQ_TYPE 16
|
||||
#define ZMQ_LINGER 17
|
||||
#define ZMQ_RECONNECT_IVL 18
|
||||
#define ZMQ_BACKLOG 19
|
||||
#define ZMQ_RECONNECT_IVL_MAX 21
|
||||
#define ZMQ_MAXMSGSIZE 22
|
||||
#define ZMQ_SNDHWM 23
|
||||
#define ZMQ_RCVHWM 24
|
||||
#define ZMQ_MULTICAST_HOPS 25
|
||||
#define ZMQ_RCVTIMEO 27
|
||||
#define ZMQ_SNDTIMEO 28
|
||||
#define ZMQ_LAST_ENDPOINT 32
|
||||
#define ZMQ_ROUTER_MANDATORY 33
|
||||
#define ZMQ_TCP_KEEPALIVE 34
|
||||
#define ZMQ_TCP_KEEPALIVE_CNT 35
|
||||
#define ZMQ_TCP_KEEPALIVE_IDLE 36
|
||||
#define ZMQ_TCP_KEEPALIVE_INTVL 37
|
||||
#define ZMQ_TCP_ACCEPT_FILTER 38
|
||||
#define ZMQ_IMMEDIATE 39
|
||||
#define ZMQ_XPUB_VERBOSE 40
|
||||
#define ZMQ_ROUTER_RAW 41
|
||||
#define ZMQ_IPV6 42
|
||||
#define ZMQ_MECHANISM 43
|
||||
#define ZMQ_PLAIN_SERVER 44
|
||||
#define ZMQ_PLAIN_USERNAME 45
|
||||
#define ZMQ_PLAIN_PASSWORD 46
|
||||
#define ZMQ_CURVE_SERVER 47
|
||||
#define ZMQ_CURVE_PUBLICKEY 48
|
||||
#define ZMQ_CURVE_SECRETKEY 49
|
||||
#define ZMQ_CURVE_SERVERKEY 50
|
||||
#define ZMQ_PROBE_ROUTER 51
|
||||
#define ZMQ_REQ_CORRELATE 52
|
||||
#define ZMQ_REQ_RELAXED 53
|
||||
#define ZMQ_CONFLATE 54
|
||||
#define ZMQ_ZAP_DOMAIN 55
|
||||
|
||||
/* Message options */
|
||||
#define ZMQ_MORE 1
|
||||
|
||||
/* Send/recv options. */
|
||||
#define ZMQ_DONTWAIT 1
|
||||
#define ZMQ_SNDMORE 2
|
||||
|
||||
/* Security mechanisms */
|
||||
#define ZMQ_NULL 0
|
||||
#define ZMQ_PLAIN 1
|
||||
#define ZMQ_CURVE 2
|
||||
|
||||
/* Deprecated options and aliases */
|
||||
#define ZMQ_IPV4ONLY 31
|
||||
#define ZMQ_DELAY_ATTACH_ON_CONNECT ZMQ_IMMEDIATE
|
||||
#define ZMQ_NOBLOCK ZMQ_DONTWAIT
|
||||
#define ZMQ_FAIL_UNROUTABLE ZMQ_ROUTER_MANDATORY
|
||||
#define ZMQ_ROUTER_BEHAVIOR ZMQ_ROUTER_MANDATORY
|
||||
|
||||
/******************************************************************************/
|
||||
/* 0MQ socket events and monitoring */
|
||||
/******************************************************************************/
|
||||
|
||||
/* Socket transport events (tcp and ipc only) */
|
||||
#define ZMQ_EVENT_CONNECTED 1
|
||||
#define ZMQ_EVENT_CONNECT_DELAYED 2
|
||||
#define ZMQ_EVENT_CONNECT_RETRIED 4
|
||||
|
||||
#define ZMQ_EVENT_LISTENING 8
|
||||
#define ZMQ_EVENT_BIND_FAILED 16
|
||||
|
||||
#define ZMQ_EVENT_ACCEPTED 32
|
||||
#define ZMQ_EVENT_ACCEPT_FAILED 64
|
||||
|
||||
#define ZMQ_EVENT_CLOSED 128
|
||||
#define ZMQ_EVENT_CLOSE_FAILED 256
|
||||
#define ZMQ_EVENT_DISCONNECTED 512
|
||||
#define ZMQ_EVENT_MONITOR_STOPPED 1024
|
||||
|
||||
#define ZMQ_EVENT_ALL ( ZMQ_EVENT_CONNECTED | ZMQ_EVENT_CONNECT_DELAYED | \
|
||||
ZMQ_EVENT_CONNECT_RETRIED | ZMQ_EVENT_LISTENING | \
|
||||
ZMQ_EVENT_BIND_FAILED | ZMQ_EVENT_ACCEPTED | \
|
||||
ZMQ_EVENT_ACCEPT_FAILED | ZMQ_EVENT_CLOSED | \
|
||||
ZMQ_EVENT_CLOSE_FAILED | ZMQ_EVENT_DISCONNECTED | \
|
||||
ZMQ_EVENT_MONITOR_STOPPED)
|
||||
|
||||
/* Socket event data */
|
||||
typedef struct {
|
||||
uint16_t event; // id of the event as bitfield
|
||||
int32_t value ; // value is either error code, fd or reconnect interval
|
||||
} zmq_event_t;
|
||||
|
||||
ZMQ_EXPORT void *zmq_socket (void *, int type);
|
||||
ZMQ_EXPORT int zmq_close (void *s);
|
||||
ZMQ_EXPORT int zmq_setsockopt (void *s, int option, const void *optval,
|
||||
size_t optvallen);
|
||||
ZMQ_EXPORT int zmq_getsockopt (void *s, int option, void *optval,
|
||||
size_t *optvallen);
|
||||
ZMQ_EXPORT int zmq_bind (void *s, const char *addr);
|
||||
ZMQ_EXPORT int zmq_connect (void *s, const char *addr);
|
||||
ZMQ_EXPORT int zmq_unbind (void *s, const char *addr);
|
||||
ZMQ_EXPORT int zmq_disconnect (void *s, const char *addr);
|
||||
ZMQ_EXPORT int zmq_send (void *s, const void *buf, size_t len, int flags);
|
||||
ZMQ_EXPORT int zmq_send_const (void *s, const void *buf, size_t len, int flags);
|
||||
ZMQ_EXPORT int zmq_recv (void *s, void *buf, size_t len, int flags);
|
||||
ZMQ_EXPORT int zmq_socket_monitor (void *s, const char *addr, int events);
|
||||
|
||||
ZMQ_EXPORT int zmq_sendmsg (void *s, zmq_msg_t *msg, int flags);
|
||||
ZMQ_EXPORT int zmq_recvmsg (void *s, zmq_msg_t *msg, int flags);
|
||||
|
||||
/* Experimental */
|
||||
struct iovec;
|
||||
|
||||
ZMQ_EXPORT int zmq_sendiov (void *s, struct iovec *iov, size_t count, int flags);
|
||||
ZMQ_EXPORT int zmq_recviov (void *s, struct iovec *iov, size_t *count, int flags);
|
||||
|
||||
/******************************************************************************/
|
||||
/* I/O multiplexing. */
|
||||
/******************************************************************************/
|
||||
|
||||
#define ZMQ_POLLIN 1
|
||||
#define ZMQ_POLLOUT 2
|
||||
#define ZMQ_POLLERR 4
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *socket;
|
||||
#if defined _WIN32
|
||||
SOCKET fd;
|
||||
#else
|
||||
int fd;
|
||||
#endif
|
||||
short events;
|
||||
short revents;
|
||||
} zmq_pollitem_t;
|
||||
|
||||
#define ZMQ_POLLITEMS_DFLT 16
|
||||
|
||||
ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout);
|
||||
|
||||
/* Built-in message proxy (3-way) */
|
||||
|
||||
ZMQ_EXPORT int zmq_proxy (void *frontend, void *backend, void *capture);
|
||||
ZMQ_EXPORT int zmq_proxy_steerable (void *frontend, void *backend, void *capture, void *control);
|
||||
|
||||
/* Encode a binary key as printable text using ZMQ RFC 32 */
|
||||
ZMQ_EXPORT char *zmq_z85_encode (char *dest, uint8_t *data, size_t size);
|
||||
|
||||
/* Encode a binary key from printable text per ZMQ RFC 32 */
|
||||
ZMQ_EXPORT uint8_t *zmq_z85_decode (uint8_t *dest, char *string);
|
||||
|
||||
/* Deprecated aliases */
|
||||
#define ZMQ_STREAMER 1
|
||||
#define ZMQ_FORWARDER 2
|
||||
#define ZMQ_QUEUE 3
|
||||
/* Deprecated method */
|
||||
ZMQ_EXPORT int zmq_device (int type, void *frontend, void *backend);
|
||||
|
||||
#undef ZMQ_EXPORT
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user