Compare commits
29 Commits
STABLE-2_0
...
STABLE-0_7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a552a9993e | ||
|
|
a74a801f35 | ||
|
|
7eae414a2f | ||
|
|
84be06c4da | ||
|
|
0912877fd7 | ||
|
|
52dd00b217 | ||
|
|
2eab21d3cf | ||
|
|
a5ce8ca555 | ||
|
|
2c02689d5c | ||
|
|
a52d3548a0 | ||
|
|
3cf8dfa55e | ||
|
|
0be1bad42f | ||
|
|
d995bc01b3 | ||
|
|
d95256817e | ||
|
|
d7c6590b8f | ||
|
|
70128cf2b9 | ||
|
|
a94db2ed71 | ||
|
|
a0f45e9d27 | ||
|
|
31c58725ce | ||
|
|
95ac72a0f2 | ||
|
|
13386978a1 | ||
|
|
95e738a955 | ||
|
|
3efda64604 | ||
|
|
98f546664e | ||
|
|
4e44c2b993 | ||
|
|
30fde02666 | ||
|
|
100eaa9855 | ||
|
|
3d287a950f | ||
|
|
3aa6a385da |
4
.gitattributes
vendored
4
.gitattributes
vendored
@@ -1,4 +0,0 @@
|
||||
# These files are text and should be normalized
|
||||
*.txt text
|
||||
*.c text
|
||||
*.h text
|
||||
12
.gitignore
vendored
12
.gitignore
vendored
@@ -1,12 +0,0 @@
|
||||
/src/apps/snmp/LwipMibCompiler/CCodeGeneration/bin/
|
||||
/src/apps/snmp/LwipMibCompiler/CCodeGeneration/obj/
|
||||
/src/apps/snmp/LwipMibCompiler/LwipMibCompiler/bin/
|
||||
/src/apps/snmp/LwipMibCompiler/LwipMibCompiler/obj/
|
||||
/src/apps/snmp/LwipMibCompiler/LwipMibViewer/bin/
|
||||
/src/apps/snmp/LwipMibCompiler/LwipMibViewer/obj/
|
||||
/src/apps/snmp/LwipMibCompiler/LwipSnmpCodeGeneration/bin/
|
||||
/src/apps/snmp/LwipMibCompiler/LwipSnmpCodeGeneration/obj/
|
||||
/src/apps/snmp/LwipMibCompiler/SharpSnmpLib/bin/
|
||||
/src/apps/snmp/LwipMibCompiler/SharpSnmpLib/obj/
|
||||
/src/apps/snmp/LwipMibCompiler/LwipMibCompiler.userprefs
|
||||
/src/apps/snmp/LwipMibCompiler/*.suo
|
||||
80
README
80
README
@@ -7,26 +7,21 @@ Science (SICS).
|
||||
|
||||
The focus of the lwIP TCP/IP implementation is to reduce the RAM usage
|
||||
while still having a full scale TCP. This making lwIP suitable for use
|
||||
in embedded systems with tens of kilobytes of free RAM and room for
|
||||
in embedded systems with tenths of kilobytes of free RAM and room for
|
||||
around 40 kilobytes of code ROM.
|
||||
|
||||
FEATURES
|
||||
|
||||
* IP (Internet Protocol) including packet forwarding over multiple network
|
||||
interfaces
|
||||
* ICMP (Internet Control Message Protocol) for network maintenance and debugging
|
||||
* IGMP (Internet Group Management Protocol) for multicast traffic management
|
||||
* UDP (User Datagram Protocol) including experimental UDP-lite extensions
|
||||
* TCP (Transmission Control Protocol) with congestion control, RTT estimation
|
||||
and fast recovery/fast retransmit
|
||||
* Specialized raw/native API for enhanced performance
|
||||
* Optional Berkeley-like socket API
|
||||
* DNS (Domain names resolver)
|
||||
* SNMP (Simple Network Management Protocol)
|
||||
* DHCP (Dynamic Host Configuration Protocol)
|
||||
* AUTOIP (for IPv4, conform with RFC 3927)
|
||||
* PPP (Point-to-Point Protocol)
|
||||
* ARP (Address Resolution Protocol) for Ethernet
|
||||
* IP (Internet Protocol) including packet forwarding over multiple
|
||||
network interfaces
|
||||
* ICMP (Internet Control Message Protocol) for network maintenance
|
||||
and debugging
|
||||
* UDP (User Datagram Protocol) including experimental UDP-lite
|
||||
extensions
|
||||
* TCP (Transmission Control Protocol) with congestion control, RTT
|
||||
estimation and fast recovery/fast retransmit
|
||||
* Specialized API for enhanced performance
|
||||
* Optional Berkeley socket API
|
||||
|
||||
LICENSE
|
||||
|
||||
@@ -40,19 +35,40 @@ and additions to the stack to further increase its usefulness.
|
||||
|
||||
Development of lwIP is hosted on Savannah, a central point for
|
||||
software development, maintenance and distribution. Everyone can
|
||||
help improve lwIP by use of Savannah's interface, Git and the
|
||||
help improve lwIP by use of Savannah's interface, CVS and the
|
||||
mailing list. A core team of developers will commit changes to the
|
||||
Git source tree.
|
||||
CVS source tree.
|
||||
|
||||
The lwIP TCP/IP stack is maintained in the 'lwip' Git module and
|
||||
contributions (such as platform ports) are in the 'contrib' Git module.
|
||||
The lwIP TCP/IP stack is maintained in the 'lwip' CVS module and
|
||||
contributions (such as platform ports) are in the 'contrib' module.
|
||||
|
||||
See doc/savannah.txt for details on Git server access for users and
|
||||
developers.
|
||||
The CVS main trunk is the stable branch, which contains bug fixes and
|
||||
tested features. The latest stable branch can be checked out by doing:
|
||||
cvs -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/lwip login
|
||||
cvs -z3 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/lwip co lwip
|
||||
|
||||
The current Git trees are web-browsable:
|
||||
http://git.savannah.gnu.org/cgit/lwip.git
|
||||
http://git.savannah.gnu.org/cgit/lwip/lwip-contrib.git
|
||||
The 'STABLE' tag in the stable branch will represent the most stable
|
||||
revision (which may be somewhat older to protect us from errors
|
||||
introduced by merges). This 'STABLE' tagged version can be checked out
|
||||
by doing:
|
||||
cvs -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/lwip login
|
||||
cvs -z3 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/lwip co -r STABLE lwip
|
||||
|
||||
The 'DEVEL' branch is the active development branch, which contains
|
||||
bleeding edge changes, and may be instable. It can be checkout by doing:
|
||||
cvs -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/lwip login
|
||||
cvs -z3 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/lwip co -r DEVEL lwip
|
||||
|
||||
The current contrib CVS tree can be checked out by doing:
|
||||
cvs -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/lwip login
|
||||
cvs -z3 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/lwip co contrib
|
||||
|
||||
Last night's CVS tar ball can be downloaded from:
|
||||
http://savannah.gnu.org/cvs.backups/lwip.tar.gz
|
||||
|
||||
The current CVS trees are web-browsable:
|
||||
http://savannah.nongnu.org/cgi-bin/viewcvs/lwip/lwip/
|
||||
http://savannah.nongnu.org/cgi-bin/viewcvs/lwip/contrib/
|
||||
|
||||
Submit patches and bugs via the lwIP project page:
|
||||
http://savannah.nongnu.org/projects/lwip/
|
||||
@@ -65,22 +81,12 @@ lwIP are at the official lwIP home page:
|
||||
http://www.sics.se/~adam/lwip/
|
||||
|
||||
Self documentation of the source code is regularly extracted from the
|
||||
current Git sources and is available from this web page:
|
||||
current CVS sources and is available from this web page:
|
||||
http://www.nongnu.org/lwip/
|
||||
|
||||
There is now a constantly growin wiki about lwIP at
|
||||
http://lwip.wikia.com/wiki/LwIP_Wiki
|
||||
|
||||
Also, there are mailing lists you can subscribe at
|
||||
http://savannah.nongnu.org/mail/?group=lwip
|
||||
plus searchable archives:
|
||||
http://lists.nongnu.org/archive/html/lwip-users/
|
||||
http://lists.nongnu.org/archive/html/lwip-devel/
|
||||
|
||||
Reading Adam's papers, the files in docs/, browsing the source code
|
||||
documentation and browsing the mailing list archives is a good way to
|
||||
become familiar with the design of lwIP.
|
||||
|
||||
Adam Dunkels <adam@sics.se>
|
||||
Leon Woestenberg <leon.woestenberg@gmx.net>
|
||||
|
||||
Leon Woestenberg <leon.woestenberg@gmx.net>
|
||||
|
||||
148
UPGRADING
148
UPGRADING
@@ -1,148 +0,0 @@
|
||||
This file lists major changes between release versions that require
|
||||
ports or applications to be changed. Use it to update a port or an
|
||||
application written for an older version of lwIP to correctly work
|
||||
with newer versions.
|
||||
|
||||
|
||||
(git master)
|
||||
|
||||
* [Enter new changes just after this line - do not remove this line]
|
||||
|
||||
* TODO
|
||||
|
||||
(1.4.0)
|
||||
|
||||
++ Application changes:
|
||||
|
||||
* Replaced struct ip_addr by typedef ip_addr_t (struct ip_addr is kept for
|
||||
compatibility to old applications, but will be removed in the future).
|
||||
|
||||
* Renamed mem_realloc() to mem_trim() to prevent confusion with realloc()
|
||||
|
||||
+++ Raw API:
|
||||
* Changed the semantics of tcp_close() (since it was rather a
|
||||
shutdown before): Now the application does *NOT* get any calls to the recv
|
||||
callback (aside from NULL/closed) after calling tcp_close()
|
||||
|
||||
* When calling tcp_abort() from a raw API TCP callback function,
|
||||
make sure you return ERR_ABRT to prevent accessing unallocated memory.
|
||||
(ERR_ABRT now means the applicaiton has called tcp_abort!)
|
||||
|
||||
+++ Netconn API:
|
||||
* Changed netconn_receive() and netconn_accept() to return
|
||||
err_t, not a pointer to new data/netconn.
|
||||
|
||||
+++ Socket API:
|
||||
* LWIP_SO_RCVTIMEO: when accept() or recv() time out, they
|
||||
now set errno to EWOULDBLOCK/EAGAIN, not ETIMEDOUT.
|
||||
|
||||
* Added a minimal version of posix fctl() to have a
|
||||
standardised way to set O_NONBLOCK for nonblocking sockets.
|
||||
|
||||
+++ all APIs:
|
||||
* correctly implemented SO(F)_REUSEADDR
|
||||
|
||||
++ Port changes
|
||||
|
||||
+++ new files:
|
||||
|
||||
* Added 4 new files: def.c, timers.c, timers.h, tcp_impl.h:
|
||||
|
||||
* Moved stack-internal parts of tcp.h to tcp_impl.h, tcp.h now only contains
|
||||
the actual application programmer's API
|
||||
|
||||
* Separated timer implementation from sys.h/.c, moved to timers.h/.c;
|
||||
Added timer implementation for NO_SYS==1, set NO_SYS_NO_TIMERS==1 if you
|
||||
still want to use your own timer implementation for NO_SYS==0 (as before).
|
||||
|
||||
+++ sys layer:
|
||||
|
||||
* Converted mbox- and semaphore-functions to take pointers to sys_mbox_t/
|
||||
sys_sem_t;
|
||||
|
||||
* Converted sys_mbox_new/sys_sem_new to take pointers and return err_t;
|
||||
|
||||
* Added Mutex concept in sys_arch (define LWIP_COMPAT_MUTEX to let sys.h use
|
||||
binary semaphores instead of mutexes - as before)
|
||||
|
||||
+++ new options:
|
||||
|
||||
* Don't waste memory when chaining segments, added option TCP_OVERSIZE to
|
||||
prevent creating many small pbufs when calling tcp_write with many small
|
||||
blocks of data. Instead, pbufs are allocated larger than needed and the
|
||||
space is used for later calls to tcp_write.
|
||||
|
||||
* Added LWIP_NETIF_TX_SINGLE_PBUF to always copy to try to create single pbufs
|
||||
in tcp_write/udp_send.
|
||||
|
||||
* Added an additional option LWIP_ETHERNET to support ethernet without ARP
|
||||
(necessary for pure PPPoE)
|
||||
|
||||
* Add MEMP_SEPARATE_POOLS to place memory pools in separate arrays. This may
|
||||
be used to place these pools into user-defined memory by using external
|
||||
declaration.
|
||||
|
||||
* Added TCP_SNDQUEUELOWAT corresponding to TCP_SNDLOWAT
|
||||
|
||||
+++ new pools:
|
||||
|
||||
* Netdb uses a memp pool for allocating memory when getaddrinfo() is called,
|
||||
so MEMP_NUM_NETDB has to be set accordingly.
|
||||
|
||||
* DNS_LOCAL_HOSTLIST_IS_DYNAMIC uses a memp pool instead of the heap, so
|
||||
MEMP_NUM_LOCALHOSTLIST has to be set accordingly.
|
||||
|
||||
* Snmp-agent uses a memp pools instead of the heap, so MEMP_NUM_SNMP_* have
|
||||
to be set accordingly.
|
||||
|
||||
* PPPoE uses a MEMP pool instead of the heap, so MEMP_NUM_PPPOE_INTERFACES
|
||||
has to be set accordingly
|
||||
|
||||
* Integrated loopif into netif.c - loopif does not have to be created by the
|
||||
port any more, just define LWIP_HAVE_LOOPIF to 1.
|
||||
|
||||
* Added define LWIP_RAND() for lwip-wide randomization (needs to be defined
|
||||
in cc.h, e.g. used by igmp)
|
||||
|
||||
* Added printf-formatter X8_F to printf u8_t as hex
|
||||
|
||||
* The heap now may be moved to user-defined memory by defining
|
||||
LWIP_RAM_HEAP_POINTER as a void pointer to that memory's address
|
||||
|
||||
* added autoip_set_struct() and dhcp_set_struct() to let autoip and dhcp work
|
||||
with user-allocated structs instead of calling mem_malloc
|
||||
|
||||
* Added const char* name to mem- and memp-stats for easier debugging.
|
||||
|
||||
* Calculate the TCP/UDP checksum while copying to only fetch data once:
|
||||
Define LWIP_CHKSUM_COPY to a memcpy-like function that returns the checksum
|
||||
|
||||
* Added SO_REUSE_RXTOALL to pass received UDP broadcast/multicast packets to
|
||||
more than one pcb.
|
||||
|
||||
* Changed the semantics of ARP_QUEUEING==0: ARP_QUEUEING now cannot be turned
|
||||
off any more, if this is set to 0, only one packet (the most recent one) is
|
||||
queued (like demanded by RFC 1122).
|
||||
|
||||
|
||||
++ Major bugfixes/improvements
|
||||
|
||||
* Implemented tcp_shutdown() to only shut down one end of a connection
|
||||
* Implemented shutdown() at socket- and netconn-level
|
||||
* Added errorset support to select() + improved select speed overhead
|
||||
* Merged pppd to v2.3.11 (including some backported bugfixes from 2.4.x)
|
||||
* Added timer implementation for NO_SYS==1 (may be disabled with NO_SYS_NO_TIMERS==1
|
||||
* Use macros defined in ip_addr.h to work with IP addresses
|
||||
* Implemented many nonblocking socket/netconn functions
|
||||
* Fixed ARP input processing: only add a new entry if a request was directed as us
|
||||
* mem_realloc() to mem_trim() to prevent confusion with realloc()
|
||||
* Some improvements for AutoIP (don't route/forward link-local addresses, don't break
|
||||
existing connections when assigning a routable address)
|
||||
* Correctly handle remote side overrunning our rcv_wnd in ooseq case
|
||||
* Removed packing from ip_addr_t, the packed version is now only used in protocol headers
|
||||
* Corrected PBUF_POOL_BUFSIZE for ports where ETH_PAD_SIZE > 0
|
||||
* Added support for static ARP table entries
|
||||
|
||||
(STABLE-1.3.2)
|
||||
|
||||
* initial version of this file
|
||||
@@ -1,6 +0,0 @@
|
||||
savannah.txt - How to obtain the current development source code.
|
||||
contrib.txt - How to contribute to lwIP as a developer.
|
||||
rawapi.txt - The documentation for the core API of lwIP.
|
||||
Also provides an overview about the other APIs and multithreading.
|
||||
snmp_agent.txt - The documentation for the lwIP SNMP agent.
|
||||
sys_arch.txt - The documentation for a system abstraction layer of lwIP.
|
||||
@@ -6,7 +6,7 @@ in lwIP development.
|
||||
2 How to contribute to lwIP
|
||||
|
||||
Here is a short list of suggestions to anybody working with lwIP and
|
||||
trying to contribute bug reports, fixes, enhancements, platform ports etc.
|
||||
trying to contribute bugreports, fixes, enhancements, platform ports etc.
|
||||
First of all as you may already know lwIP is a volunteer project so feedback
|
||||
to fixes or questions might often come late. Hopefully the bug and patch tracking
|
||||
features of Savannah help us not lose users' input.
|
||||
@@ -14,27 +14,25 @@ features of Savannah help us not lose users' input.
|
||||
2.1 Source code style:
|
||||
|
||||
1. do not use tabs.
|
||||
2. indentation is two spaces per level (i.e. per tab).
|
||||
2. identation is two spaces per level.
|
||||
3. end debug messages with a trailing newline (\n).
|
||||
4. one space between keyword and opening bracket.
|
||||
5. no space between function and opening bracket.
|
||||
6. one space and no newline before opening curly braces of a block.
|
||||
7. closing curly brace on a single line.
|
||||
8. spaces surrounding assignment and comparisons.
|
||||
9. don't initialize static and/or global variables to zero, the compiler takes care of that.
|
||||
10. use current source code style as further reference.
|
||||
7. spaces surrounding assignment and comparisons.
|
||||
8. use current source code style as further reference.
|
||||
|
||||
2.2 Source code documentation style:
|
||||
|
||||
1. JavaDoc compliant and Doxygen compatible.
|
||||
2. Function documentation above functions in .c files, not .h files.
|
||||
(This forces you to synchronize documentation and implementation.)
|
||||
(This forces you to synchronize documentation and behaviour.)
|
||||
3. Use current documentation style as further reference.
|
||||
|
||||
2.3 Bug reports and patches:
|
||||
|
||||
1. Make sure you are reporting bugs or send patches against the latest
|
||||
sources. (From the latest release and/or the current Git sources.)
|
||||
sources. (From the latest release and/or the current CVS sources.)
|
||||
2. If you think you found a bug make sure it's not already filed in the
|
||||
bugtracker at Savannah.
|
||||
3. If you have a fix put the patch on Savannah. If it is a patch that affects
|
||||
@@ -46,13 +44,20 @@ features of Savannah help us not lose users' input.
|
||||
4. Do not file a bug and post a fix to it to the patch area. Either a bug report
|
||||
or a patch will be enough.
|
||||
If you correct an existing bug then attach the patch to the bug rather than creating a new entry in the patch area.
|
||||
5. Patches should be specific to a single change or to related changes. Do not mix bugfixes with spelling and other
|
||||
trivial fixes unless the bugfix is trivial too. Do not reorganize code and rename identifiers in the same patch you
|
||||
change behaviour if not necessary. A patch is easier to read and understand if it's to the point and short than
|
||||
5. Trivial patches (compiler warning, indentation and spelling fixes or anything obvious which takes a line or two)
|
||||
can go to the lwip-users list. This is still the fastest way of interaction and the list is not so crowded
|
||||
as to allow for loss of fixes. Putting bugs on Savannah and subsequently closing them is too much an overhead
|
||||
for reporting a compiler warning fix.
|
||||
6. Patches should be specific to a single change or to related changes.Do not mix bugfixes with spelling and other
|
||||
trivial fixes unless the bugfix is trivial too.Do not reorganize code and rename identifiers in the same patch you
|
||||
change behaviour if not necessary.A patch is easier to read and understand if it's to the point and short than
|
||||
if it's not to the point and long :) so the chances for it to be applied are greater.
|
||||
|
||||
2.4 Platform porters:
|
||||
|
||||
1. If you have ported lwIP to a platform (an OS, a uC/processor or a combination of these) and
|
||||
you think it could benefit others[1] you might want discuss this on the mailing list. You
|
||||
can also ask for Git access to submit and maintain your port in the contrib Git module.
|
||||
1. If you've ported lwIP to a platform (an OS, a uC/processor or a combination of these) and you think it
|
||||
could benefit others[1] you might want to post an url to a tarball or zip from which it can be imported
|
||||
to the contrib CVS module. Then you get CVS access and have to maintain your port :)
|
||||
|
||||
[1] - lwIP CVS should not be just a place to keep your port so you don't have to set up your own CVS :)
|
||||
Especially welcome are ports to common enough OS/hardware that others can have access too.
|
||||
|
||||
@@ -1,292 +0,0 @@
|
||||
# Doxyfile 1.5.4
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = "lwIP 1.3.0"
|
||||
PROJECT_NUMBER = "lwIP 1.3.0"
|
||||
OUTPUT_DIRECTORY = C:/OPENSOURCE/LwIP/doxygen
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class " \
|
||||
"The $name widget " \
|
||||
"The $name file " \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = C:\OPENSOURCE\lwip
|
||||
STRIP_FROM_INC_PATH = C:\OPENSOURCE\lwip
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = NO
|
||||
QT_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 8
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
BUILTIN_STL_SUPPORT = NO
|
||||
CPP_CLI_SUPPORT = NO
|
||||
SIP_SUPPORT = NO
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
SUBGROUPING = YES
|
||||
TYPEDEF_HIDES_STRUCT = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = NO
|
||||
EXTRACT_STATIC = NO
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = NO
|
||||
EXTRACT_ANON_NSPACES = NO
|
||||
HIDE_UNDOC_MEMBERS = YES
|
||||
HIDE_UNDOC_CLASSES = YES
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = NO
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = YES
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text "
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = C:\OPENSOURCE\lwip\lwip
|
||||
INPUT_ENCODING = UTF-8
|
||||
FILE_PATTERNS = *.c \
|
||||
*.cc \
|
||||
*.cxx \
|
||||
*.cpp \
|
||||
*.c++ \
|
||||
*.java \
|
||||
*.ii \
|
||||
*.ixx \
|
||||
*.ipp \
|
||||
*.i++ \
|
||||
*.inl \
|
||||
*.h \
|
||||
*.hh \
|
||||
*.hxx \
|
||||
*.hpp \
|
||||
*.h++ \
|
||||
*.idl \
|
||||
*.odl \
|
||||
*.cs \
|
||||
*.php \
|
||||
*.php3 \
|
||||
*.inc \
|
||||
*.m \
|
||||
*.mm \
|
||||
*.dox
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXCLUDE_SYMBOLS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = NO
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = NO
|
||||
REFERENCES_RELATION = NO
|
||||
REFERENCES_LINK_SOURCE = YES
|
||||
USE_HTAGS = NO
|
||||
VERBATIM_HEADERS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = NO
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = C:/OPENSOURCE/lwIP/doxygen/output/html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = NO
|
||||
HTML_DYNAMIC_SECTIONS = NO
|
||||
CHM_FILE = lwip.chm
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = NO
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = YES
|
||||
RTF_OUTPUT = C:/OPENSOURCE/lwIP/doxygen/output/rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = NO
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = NO
|
||||
MACRO_EXPANSION = YES
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH = C:\OPENSOURCE\lwip\lwip
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED = NO_SYS=0 \
|
||||
SYS_LIGHTWEIGHT_PROT=1 \
|
||||
LWIP_ICMP=1 \
|
||||
LWIP_RAW=1 \
|
||||
LWIP_DHCP=1 \
|
||||
LWIP_UDPLITE=1 \
|
||||
LWIP_UDP=1 \
|
||||
LWIP_IGMP=1 \
|
||||
LWIP_TCP=1 \
|
||||
LWIP_SNMP=1 \
|
||||
MEMP_OVERFLOW_CHECK=1 \
|
||||
MEMP_SANITY_CHECK=1 \
|
||||
LWIP_ARP=1 \
|
||||
LWIP_NETIF_HOSTNAME=1 \
|
||||
LWIP_NETIF_API=1 \
|
||||
LWIP_NETIF_CALLBACK=1 \
|
||||
LWIP_NETIF_LINK_CALLBACK=1 \
|
||||
LWIP_AUTOIP=1 \
|
||||
ARP_QUEUEING=1 \
|
||||
LWIP_STATS=1 \
|
||||
MEM_USE_POOLS=0 \
|
||||
LWIP_DNS=1 \
|
||||
LWIP_SOCKETS=1 \
|
||||
LWIP_NETCONN=1 \
|
||||
"LWIP_DNS && LWIP_SOCKET " \
|
||||
"(LWIP_DNS && LWIP_SOCKET)=1 "
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE =
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
MSCGEN_PATH =
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
CALLER_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
DOT_GRAPH_MAX_NODES = 50
|
||||
MAX_DOT_GRAPH_DEPTH = 1000
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = NO
|
||||
@@ -1,47 +0,0 @@
|
||||
/*! \mainpage lwIP Documentation
|
||||
*
|
||||
* \section intro_sec Introduction
|
||||
*
|
||||
* lwIP is a small independent implementation of the TCP/IP protocol suite that has been developed by Adam Dunkels at the Computer and Networks Architectures (CNA) lab at the Swedish Institute of Computer Science (SICS).
|
||||
*
|
||||
* The focus of the lwIP TCP/IP implementation is to reduce resource usage while still having a full scale TCP. This making lwIP suitable for use in embedded systems with tens of kilobytes of free RAM and room for around 40 kilobytes of code ROM.
|
||||
*
|
||||
* \section lwip_features_sec lwIP features:
|
||||
*
|
||||
* \li \c IP (Internet Protocol) including packet forwarding over multiple network interfaces\n
|
||||
* \li \c ICMP (Internet Control Message Protocol) for network maintenance and debugging\n
|
||||
* \li \c IGMP (Internet Group Management Protocol) for multicast traffic management\n
|
||||
* \li \c UDP (User Datagram Protocol) including experimental UDP-lite extensions\n
|
||||
* \li \c TCP (Transmission Control Protocol) with congestion control, RTT estimation and fast recovery/fast retransmit\n
|
||||
* \li \c raw/native API for enhanced performance\n
|
||||
* \li \c Optional Berkeley-like socket API\n
|
||||
* \li \c DNS (Domain names resolver)\n
|
||||
* \li \c SNMP (Simple Network Management Protocol)\n
|
||||
* \li \c DHCP (Dynamic Host Configuration Protocol)\n
|
||||
* \li \c AUTOIP (for IPv4, conform with RFC 3927)\n
|
||||
* \li \c PPP (Point-to-Point Protocol)\n
|
||||
* \li \c ARP (Address Resolution Protocol) for Ethernet\n
|
||||
*
|
||||
* \section install_sec Documentation
|
||||
*
|
||||
* Development of lwIP is hosted on Savannah, a central point for software development, maintenance and distribution. Everyone can help improve lwIP by use of Savannah's interface, Git and the mailing list. A core team of developers will commit changes to the Git source tree.\n
|
||||
* http://savannah.nongnu.org/projects/lwip/\n
|
||||
* \n
|
||||
* The original out-dated homepage of lwIP and Adam Dunkels' papers on lwIP are at the official lwIP home page:\n
|
||||
* http://www.sics.se/~adam/lwip/\n
|
||||
* \n
|
||||
* Self documentation of the source code is regularly extracted from the current Git sources and is available from this web page:\n
|
||||
* http://www.nongnu.org/lwip/\n
|
||||
* \n
|
||||
* There is now a constantly growin wiki about lwIP at\n
|
||||
* http://lwip.wikia.com/\n
|
||||
* \n
|
||||
* Also, there are mailing lists you can subscribe at\n
|
||||
* http://savannah.nongnu.org/mail/?group=lwip\n
|
||||
* plus searchable archives:\n
|
||||
* http://lists.nongnu.org/archive/html/lwip-users/\n
|
||||
* http://lists.nongnu.org/archive/html/lwip-devel/\n
|
||||
* \n
|
||||
* Reading Adam's papers, the files in docs/, browsing the source code documentation and browsing the mailing list archives is a good way to become familiar with the design of lwIP.\n
|
||||
*
|
||||
*/
|
||||
423
doc/ppp.txt
423
doc/ppp.txt
@@ -1,423 +0,0 @@
|
||||
PPP interface for lwIP
|
||||
|
||||
Author: Sylvain Rochet
|
||||
|
||||
Table of Contents:
|
||||
|
||||
1 - Supported PPP protocols and features
|
||||
2 - Raw API PPP example for all protocols
|
||||
3 - PPPoS input path (raw API, IRQ safe API, TCPIP API)
|
||||
4 - Thread safe PPP API (PPPAPI)
|
||||
5 - Upgrading from lwIP <= 1.4.x to lwIP >= 1.5.x
|
||||
|
||||
|
||||
|
||||
1 Supported PPP protocols and features
|
||||
======================================
|
||||
|
||||
Supported Low level protocols:
|
||||
* PPP over serial using HDLC-like framing, such as wired dialup modems
|
||||
or mobile telecommunications GPRS/EDGE/UMTS/HSPA+/LTE modems
|
||||
* PPP over Ethernet, such as xDSL modems
|
||||
* PPP over L2TP (Layer 2 Tunneling Protocol) LAC (L2TP Access Concentrator),
|
||||
IP tunnel over UDP, such as VPN access
|
||||
|
||||
Supported auth protocols:
|
||||
* PAP, Password Authentication Protocol
|
||||
* CHAP, Challenge-Handshake Authentication Protocol, also known as CHAP-MD5
|
||||
* MSCHAPv1, Microsoft version of CHAP, version 1
|
||||
* MSCHAPv2, Microsoft version of CHAP, version 2
|
||||
* EAP, Extensible Authentication Protocol
|
||||
|
||||
Supported address protocols:
|
||||
* IPCP, IP Control Protocol, IPv4 addresses negotiation
|
||||
* IP6CP, IPv6 Control Protocol, IPv6 link-local addresses negotiation
|
||||
|
||||
Supported encryption protocols:
|
||||
* MPPE, Microsoft Point-to-Point Encryption
|
||||
|
||||
Supported compression or miscellaneous protocols, for serial links only:
|
||||
* PFC, Protocol Field Compression
|
||||
* ACFC, Address-and-Control-Field-Compression
|
||||
* ACCM, Asynchronous-Control-Character-Map
|
||||
* VJ, Van Jacobson TCP/IP Header Compression
|
||||
|
||||
|
||||
|
||||
2 Raw API PPP example for all protocols
|
||||
=======================================
|
||||
|
||||
As usual, raw API for lwIP means the lightweight API which *MUST* only be used
|
||||
for NO_SYS=1 systems or called inside lwIP core thread for NO_SYS=0 systems.
|
||||
|
||||
/*
|
||||
* Globals
|
||||
* =======
|
||||
*/
|
||||
|
||||
/* The PPP control block */
|
||||
ppp_pcb *ppp;
|
||||
|
||||
/* The PPP IP interface */
|
||||
struct netif ppp_netif;
|
||||
|
||||
|
||||
/*
|
||||
* PPP status callback
|
||||
* ===================
|
||||
*
|
||||
* PPP status callback is called on PPP status change (up, down, …) from lwIP
|
||||
* core thread
|
||||
*/
|
||||
|
||||
/* PPP status callback example */
|
||||
static void status_cb(ppp_pcb *pcb, int err_code, void *ctx) {
|
||||
struct netif *pppif = ppp_netif(pcb);
|
||||
LWIP_UNUSED_ARG(ctx);
|
||||
|
||||
switch(err_code) {
|
||||
case PPPERR_NONE: {
|
||||
#if LWIP_DNS
|
||||
ip_addr_t ns;
|
||||
#endif /* LWIP_DNS */
|
||||
printf("status_cb: Connected\n");
|
||||
#if PPP_IPV4_SUPPORT
|
||||
printf(" our_ipaddr = %s\n", ipaddr_ntoa(&pppif->ip_addr));
|
||||
printf(" his_ipaddr = %s\n", ipaddr_ntoa(&pppif->gw));
|
||||
printf(" netmask = %s\n", ipaddr_ntoa(&pppif->netmask));
|
||||
#if LWIP_DNS
|
||||
ns = dns_getserver(0);
|
||||
printf(" dns1 = %s\n", ipaddr_ntoa(&ns));
|
||||
ns = dns_getserver(1);
|
||||
printf(" dns2 = %s\n", ipaddr_ntoa(&ns));
|
||||
#endif /* LWIP_DNS */
|
||||
#endif /* PPP_IPV4_SUPPORT */
|
||||
#if PPP_IPV6_SUPPORT
|
||||
printf(" our6_ipaddr = %s\n", ip6addr_ntoa(netif_ip6_addr(pppif, 0)));
|
||||
#endif /* PPP_IPV6_SUPPORT */
|
||||
break;
|
||||
}
|
||||
case PPPERR_PARAM: {
|
||||
printf("status_cb: Invalid parameter\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_OPEN: {
|
||||
printf("status_cb: Unable to open PPP session\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_DEVICE: {
|
||||
printf("status_cb: Invalid I/O device for PPP\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_ALLOC: {
|
||||
printf("status_cb: Unable to allocate resources\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_USER: {
|
||||
printf("status_cb: User interrupt\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_CONNECT: {
|
||||
printf("status_cb: Connection lost\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_AUTHFAIL: {
|
||||
printf("status_cb: Failed authentication challenge\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_PROTOCOL: {
|
||||
printf("status_cb: Failed to meet protocol\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_PEERDEAD: {
|
||||
printf("status_cb: Connection timeout\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_IDLETIMEOUT: {
|
||||
printf("status_cb: Idle Timeout\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_CONNECTTIME: {
|
||||
printf("status_cb: Max connect time reached\n");
|
||||
break;
|
||||
}
|
||||
case PPPERR_LOOPBACK: {
|
||||
printf("status_cb: Loopback detected\n");
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
printf("status_cb: Unknown error code %d\n", err_code);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This should be in the switch case, this is put outside of the switch
|
||||
* case for example readability.
|
||||
*/
|
||||
|
||||
if (err_code == PPPERR_NONE) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* ppp_close() was previously called, don't reconnect */
|
||||
if (err_code == PPPERR_USER) {
|
||||
/* ppp_free(); -- can be called here */
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Try to reconnect in 30 seconds, if you need a modem chatscript you have
|
||||
* to do a much better signaling here ;-)
|
||||
*/
|
||||
ppp_connect(pcb, 30);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Creating a new PPPoS session
|
||||
* ============================
|
||||
*
|
||||
* In lwIP, PPPoS is not PPPoSONET, in lwIP PPPoS is PPPoSerial.
|
||||
*/
|
||||
|
||||
#include "netif/ppp/pppos.h"
|
||||
|
||||
/*
|
||||
* PPPoS serial output callback
|
||||
*
|
||||
* ppp_pcb, PPP control block
|
||||
* data, buffer to write to serial port
|
||||
* len, length of the data buffer
|
||||
* ctx, optional user-provided callback context pointer
|
||||
*
|
||||
* Return value: len if write succeed
|
||||
*/
|
||||
static u32_t output_cb(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx) {
|
||||
return uart_write(UART, data, len);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a new PPPoS interface
|
||||
*
|
||||
* ppp_netif, netif to use for this PPP link, i.e. PPP IP interface
|
||||
* output_cb, PPPoS serial output callback
|
||||
* status_cb, PPP status callback, called on PPP status change (up, down, …)
|
||||
* ctx_cb, optional user-provided callback context pointer
|
||||
*/
|
||||
ppp = pppos_create(&ppp_netif,
|
||||
output_cb, status_cb, ctx_cb);
|
||||
|
||||
|
||||
/*
|
||||
* Creating a new PPPoE session
|
||||
* ============================
|
||||
*/
|
||||
|
||||
#include "netif/ppp/pppoe.h"
|
||||
|
||||
/*
|
||||
* Create a new PPPoE interface
|
||||
*
|
||||
* ppp_netif, netif to use for this PPP link, i.e. PPP IP interface
|
||||
* ethif, already existing and setup Ethernet interface to use
|
||||
* service_name, PPPoE service name discriminator (not supported yet)
|
||||
* concentrator_name, PPPoE concentrator name discriminator (not supported yet)
|
||||
* status_cb, PPP status callback, called on PPP status change (up, down, …)
|
||||
* ctx_cb, optional user-provided callback context pointer
|
||||
*/
|
||||
ppp = pppoe_create(&ppp_netif,
|
||||
ðif,
|
||||
service_name, concentrator_name,
|
||||
status_cb, ctx_cb);
|
||||
|
||||
|
||||
/*
|
||||
* Creating a new PPPoL2TP session
|
||||
* ===============================
|
||||
*/
|
||||
|
||||
#include "netif/ppp/pppol2tp.h"
|
||||
|
||||
/*
|
||||
* Create a new PPPoL2TP interface
|
||||
*
|
||||
* ppp_netif, netif to use for this PPP link, i.e. PPP IP interface
|
||||
* netif, optional already existing and setup output netif, necessary if you
|
||||
* want to set this interface as default route to settle the chicken
|
||||
* and egg problem with VPN links
|
||||
* ipaddr, IP to connect to
|
||||
* port, UDP port to connect to (usually 1701)
|
||||
* secret, L2TP secret to use
|
||||
* secret_len, size in bytes of the L2TP secret
|
||||
* status_cb, PPP status callback, called on PPP status change (up, down, …)
|
||||
* ctx_cb, optional user-provided callback context pointer
|
||||
*/
|
||||
ppp = pppol2tp_create(&ppp_netif,
|
||||
struct netif *netif, ip_addr_t *ipaddr, u16_t port,
|
||||
u8_t *secret, u8_t secret_len,
|
||||
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
|
||||
|
||||
|
||||
/*
|
||||
* PPP link configuration
|
||||
* ======================
|
||||
*/
|
||||
|
||||
/* Auth configuration, this is pretty self-explanatory */
|
||||
ppp_set_auth(ppp, PPPAUTHTYPE_ANY, "login", "password");
|
||||
|
||||
/* Set this interface as default route */
|
||||
ppp_set_default(ppp);
|
||||
|
||||
|
||||
/*
|
||||
* Initiate PPP connection
|
||||
* =======================
|
||||
*/
|
||||
|
||||
/*
|
||||
* Initiate PPP negotiation, without waiting (holdoff=0), can only be called
|
||||
* if PPP session is in the dead state (i.e. disconnected).
|
||||
*/
|
||||
u16_t holdoff = 0;
|
||||
ppp_connect(ppp, holdoff);
|
||||
|
||||
|
||||
/*
|
||||
* Closing PPP connection
|
||||
* ======================
|
||||
*/
|
||||
|
||||
/*
|
||||
* Initiate the end of the PPP session, without carrier lost signal
|
||||
* (nocarrier=0), meaning a clean shutdown of PPP protocols.
|
||||
* You can call this function at anytime.
|
||||
*/
|
||||
u8_t nocarrier = 0;
|
||||
ppp_close(ppp, nocarrier);
|
||||
/*
|
||||
* Then you must wait your status_cb() to be called, it may takes from a few
|
||||
* seconds to several tens of seconds depending on the current PPP state.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Freeing a PPP connection
|
||||
* ========================
|
||||
*/
|
||||
|
||||
/*
|
||||
* Free the PPP control block, can only be called if PPP session is in the
|
||||
* dead state (i.e. disconnected). You need to call ppp_close() before.
|
||||
*/
|
||||
ppp_free(ppp);
|
||||
|
||||
|
||||
|
||||
3 PPPoS input path (raw API, IRQ safe API, TCPIP API)
|
||||
=====================================================
|
||||
|
||||
Received data on serial port should be sent to lwIP using the pppos_input()
|
||||
function or the pppos_input_tcpip() function.
|
||||
|
||||
If NO_SYS is 1 and if PPP_INPROC_IRQ_SAFE is 0 (the default), pppos_input()
|
||||
is not IRQ safe and then *MUST* only be called inside your main loop.
|
||||
|
||||
Whatever the NO_SYS value, if PPP_INPROC_IRQ_SAFE is 1, pppos_input() is IRQ
|
||||
safe and can be safely called from an interrupt context, using that is going
|
||||
to reduce your need of buffer if pppos_input() is called byte after byte in
|
||||
your rx serial interrupt.
|
||||
|
||||
if NO_SYS is 0, the thread safe way outside an interrupt context is to use
|
||||
the pppos_input_tcpip() function to pass input data to the lwIP core thread
|
||||
using the TCPIP API. This is thread safe in all cases but you should avoid
|
||||
passing data byte after byte because it uses heavy locking (mailbox) and it
|
||||
allocates pbuf, better fill them !
|
||||
|
||||
if NO_SYS is 0 and if PPP_INPROC_IRQ_SAFE is 1, you may also use pppos_input()
|
||||
from an RX thread, however pppos_input() is not thread safe by itself. You can
|
||||
do that *BUT* you should NEVER call pppos_connect(), pppos_listen() and
|
||||
ppp_free() if pppos_input() can still be running, doing this is NOT thread safe
|
||||
at all. Using PPP_INPROC_IRQ_SAFE from an RX thread is discouraged unless you
|
||||
really know what you are doing, your move ;-)
|
||||
|
||||
|
||||
/*
|
||||
* Fonction to call for received data
|
||||
*
|
||||
* ppp, PPP control block
|
||||
* buffer, input buffer
|
||||
* buffer_len, buffer length in bytes
|
||||
*/
|
||||
void pppos_input(ppp, buffer, buffer_len);
|
||||
|
||||
or
|
||||
|
||||
void pppos_input_tcpip(ppp, buffer, buffer_len);
|
||||
|
||||
|
||||
4 Thread safe PPP API (PPPAPI)
|
||||
==============================
|
||||
|
||||
There is a thread safe API for all corresponding ppp_* functions, you have to
|
||||
enable LWIP_PPP_API in your lwipopts.h file, then see include/lwip/pppapi.h,
|
||||
this is actually pretty obvious.
|
||||
|
||||
|
||||
|
||||
5 Upgrading from lwIP <= 1.4.x to lwIP >= 1.5.x
|
||||
===============================================
|
||||
|
||||
PPP API was fully reworked between 1.4.x and 1.5.x releases. However porting
|
||||
from previous lwIP version is pretty easy:
|
||||
|
||||
* Previous PPP API used an integer to identify PPP sessions, we are now
|
||||
using ppp_pcb* control block, therefore all functions changed from "int ppp"
|
||||
to "ppp_pcb *ppp"
|
||||
|
||||
* struct netif was moved outside the PPP structure, you have to provide a netif
|
||||
for PPP interface in pppoX_create() functions
|
||||
|
||||
* PPP session are not started automatically after you created them anymore,
|
||||
you have to call ppp_connect(), this way you can configure the session before
|
||||
starting it.
|
||||
|
||||
* Previous PPP API used CamelCase, we are now using snake_case.
|
||||
|
||||
* Previous PPP API mixed PPPoS and PPPoE calls, this isn't the case anymore,
|
||||
PPPoS functions are now prefixed pppos_ and PPPoE functions are now prefixed
|
||||
pppoe_, common functions are now prefixed ppp_.
|
||||
|
||||
* New PPPERR_ error codes added, check you have all of them in your status
|
||||
callback function
|
||||
|
||||
* Only the following include files should now be used in user application:
|
||||
#include "lwip/pppapi.h"
|
||||
#include "netif/ppp/pppos.h"
|
||||
#include "netif/ppp/pppoe.h"
|
||||
#include "netif/ppp/pppol2tp.h"
|
||||
|
||||
Functions from ppp.h can be used, but you don't need to include this header
|
||||
file as it is already included by above header files.
|
||||
|
||||
* PPP_INPROC_OWNTHREAD was broken by design and was removed, you have to create
|
||||
your own serial rx thread
|
||||
|
||||
* PPP_INPROC_MULTITHREADED option was misnamed and confusing and was renamed
|
||||
PPP_INPROC_IRQ_SAFE, please read the "PPPoS input path" documentation above
|
||||
because you might have been fooled by that
|
||||
|
||||
* If you used tcpip_callback_with_block() on ppp_ functions you may wish to use
|
||||
the PPPAPI API instead.
|
||||
|
||||
* ppp_sighup and ppp_close functions were merged using an optional argument
|
||||
"nocarrier" on ppp_close.
|
||||
|
||||
* DNS servers are now only remotely asked if LWIP_DNS is set and we are now
|
||||
unconditionally registering them, which is probably the wanted behavior in
|
||||
almost all cases. If you need it conditional contact us and we will made it
|
||||
conditional.
|
||||
|
||||
* PPPoS now requires a serial output callback
|
||||
|
||||
* PPP_MAXIDLEFLAG is now in ms instead of jiffies
|
||||
302
doc/rawapi.txt
302
doc/rawapi.txt
@@ -1,76 +1,20 @@
|
||||
Raw TCP/IP interface for lwIP
|
||||
Raw TCP/IP interface for lwIP 0.5
|
||||
|
||||
Authors: Adam Dunkels, Leon Woestenberg, Christiaan Simons
|
||||
Author: Adam Dunkels
|
||||
|
||||
lwIP provides three Application Program's Interfaces (APIs) for programs
|
||||
to use for communication with the TCP/IP code:
|
||||
* low-level "core" / "callback" or "raw" API.
|
||||
* higher-level "sequential" API.
|
||||
* BSD-style socket API.
|
||||
|
||||
The raw API (sometimes called native API) is an event-driven API designed
|
||||
to be used without an operating system that implements zero-copy send and
|
||||
receive. This API is also used by the core stack for interaction between
|
||||
the various protocols. It is the only API available when running lwIP
|
||||
without an operating system.
|
||||
lwIP provides two Application Program's Interfaces (APIs) for programs
|
||||
to use for communication with the TCP/IP code: the sequential API
|
||||
(often just called "the API") and the raw TCP/IP interface. This
|
||||
document is intended as a description of the latter. For lwIP versions
|
||||
lower than 0.5, this API was not documented.
|
||||
|
||||
The sequential API provides a way for ordinary, sequential, programs
|
||||
to use the lwIP stack. It is quite similar to the BSD socket API. The
|
||||
model of execution is based on the blocking open-read-write-close
|
||||
model of execution is based on the open-read-write-close
|
||||
paradigm. Since the TCP/IP stack is event based by nature, the TCP/IP
|
||||
code and the application program must reside in different execution
|
||||
contexts (threads).
|
||||
|
||||
The socket API is a compatibility API for existing applications,
|
||||
currently it is built on top of the sequential API. It is meant to
|
||||
provide all functions needed to run socket API applications running
|
||||
on other platforms (e.g. unix / windows etc.). However, due to limitations
|
||||
in the specification of this API, there might be incompatibilities
|
||||
that require small modifications of existing programs.
|
||||
|
||||
** Multithreading
|
||||
|
||||
lwIP started targeting single-threaded environments. When adding multi-
|
||||
threading support, instead of making the core thread-safe, another
|
||||
approach was chosen: there is one main thread running the lwIP core
|
||||
(also known as the "tcpip_thread"). When running in a multithreaded
|
||||
environment, raw API functions MUST only be called from the core thread
|
||||
since raw API functions are not protected from concurrent access (aside
|
||||
from pbuf- and memory management functions). Application threads using
|
||||
the sequential- or socket API communicate with this main thread through
|
||||
message passing.
|
||||
|
||||
As such, the list of functions that may be called from
|
||||
other threads or an ISR is very limited! Only functions
|
||||
from these API header files are thread-safe:
|
||||
- api.h
|
||||
- netbuf.h
|
||||
- netdb.h
|
||||
- netifapi.h
|
||||
- pppapi.h
|
||||
- sockets.h
|
||||
- sys.h
|
||||
|
||||
Additionaly, memory (de-)allocation functions may be
|
||||
called from multiple threads (not ISR!) with NO_SYS=0
|
||||
since they are protected by SYS_LIGHTWEIGHT_PROT and/or
|
||||
semaphores.
|
||||
|
||||
Netconn or Socket API functions are thread safe against the
|
||||
core thread but they are not reentrant at the control block
|
||||
granularity level. That is, a UDP or TCP control block must
|
||||
not be shared among multiple threads without proper locking.
|
||||
|
||||
If SYS_LIGHTWEIGHT_PROT is set to 1 and
|
||||
LWIP_ALLOW_MEM_FREE_FROM_OTHER_CONTEXT is set to 1,
|
||||
pbuf_free() may also be called from another thread or
|
||||
an ISR (since only then, mem_free - for PBUF_RAM - may
|
||||
be called from an ISR: otherwise, the HEAP is only
|
||||
protected by semaphores).
|
||||
|
||||
|
||||
** The remainder of this document discusses the "raw" API. **
|
||||
|
||||
The raw TCP/IP interface allows the application program to integrate
|
||||
better with the TCP/IP code. Program execution is event based by
|
||||
having callback functions being called from within the TCP/IP
|
||||
@@ -86,28 +30,14 @@ the raw TCP/IP interface are more difficult to understand. Still, this
|
||||
is the preferred way of writing applications that should be small in
|
||||
code size and memory usage.
|
||||
|
||||
All APIs can be used simultaneously by different application
|
||||
Both APIs can be used simultaneously by different application
|
||||
programs. In fact, the sequential API is implemented as an application
|
||||
program using the raw TCP/IP interface.
|
||||
|
||||
Do not confuse the lwIP raw API with raw Ethernet or IP sockets.
|
||||
The former is a way of interfacing the lwIP network stack (including
|
||||
TCP and UDP), the later refers to processing raw Ethernet or IP data
|
||||
instead of TCP connections or UDP packets.
|
||||
|
||||
Raw API applications may never block since all packet processing
|
||||
(input and output) as well as timer processing (TCP mainly) is done
|
||||
in a single execution context.
|
||||
|
||||
--- Callbacks
|
||||
|
||||
Program execution is driven by callbacks functions, which are then
|
||||
invoked by the lwIP core when activity related to that application
|
||||
occurs. A particular application may register to be notified via a
|
||||
callback function for events such as incoming data available, outgoing
|
||||
data sent, error notifications, poll timer expiration, connection
|
||||
closed, etc. An application can provide a callback function to perform
|
||||
processing for any or all of these events. Each callback is an ordinary
|
||||
Program execution is driven by callbacks. Each callback is an ordinary
|
||||
C function that is called from within the TCP/IP code. Every callback
|
||||
function is passed the current TCP or UDP connection state as an
|
||||
argument. Also, in order to be able to keep program specific state,
|
||||
@@ -137,7 +67,7 @@ incoming connections or be explicitly connected to another host.
|
||||
Creates a new connection identifier (PCB). If memory is not
|
||||
available for creating the new pcb, NULL is returned.
|
||||
|
||||
- err_t tcp_bind(struct tcp_pcb *pcb, ip_addr_t *ipaddr,
|
||||
- err_t tcp_bind(struct tcp_pcb *pcb, struct ip_addr *ipaddr,
|
||||
u16_t port)
|
||||
|
||||
Binds the pcb to a local IP address and port number. The IP address
|
||||
@@ -165,29 +95,14 @@ incoming connections or be explicitly connected to another host.
|
||||
listening connection. If so, the memory associated with the pcb
|
||||
passed as an argument to tcp_listen() will not be deallocated.
|
||||
|
||||
- struct tcp_pcb *tcp_listen_with_backlog(struct tcp_pcb *pcb, u8_t backlog)
|
||||
|
||||
Same as tcp_listen, but limits the number of outstanding connections
|
||||
in the listen queue to the value specified by the backlog argument.
|
||||
To use it, your need to set TCP_LISTEN_BACKLOG=1 in your lwipopts.h.
|
||||
|
||||
- void tcp_accepted(struct tcp_pcb *pcb)
|
||||
|
||||
Inform lwIP that an incoming connection has been accepted. This would
|
||||
usually be called from the accept callback. This allows lwIP to perform
|
||||
housekeeping tasks, such as allowing further incoming connections to be
|
||||
queued in the listen backlog.
|
||||
ATTENTION: the PCB passed in must be the listening pcb, not the pcb passed
|
||||
into the accept callback!
|
||||
|
||||
- void tcp_accept(struct tcp_pcb *pcb,
|
||||
err_t (* accept)(void *arg, struct tcp_pcb *newpcb,
|
||||
err_t err))
|
||||
|
||||
Specified the callback function that should be called when a new
|
||||
connection arrives on a listening connection.
|
||||
|
||||
- err_t tcp_connect(struct tcp_pcb *pcb, ip_addr_t *ipaddr,
|
||||
|
||||
- err_t tcp_connect(struct tcp_pcb *pcb, struct ip_addr *ipaddr,
|
||||
u16_t port, err_t (* connected)(void *arg,
|
||||
struct tcp_pcb *tpcb,
|
||||
err_t err));
|
||||
@@ -200,15 +115,14 @@ incoming connections or be explicitly connected to another host.
|
||||
function specified as the fourth argument (the "connected" argument)
|
||||
when the connection is established. If the connection could not be
|
||||
properly established, either because the other host refused the
|
||||
connection or because the other host didn't answer, the "err"
|
||||
callback function of this pcb (registered with tcp_err, see below)
|
||||
will be called.
|
||||
connection or because the other host didn't answer, the "connected"
|
||||
function will be called with an the "err" argument set accordingly.
|
||||
|
||||
The tcp_connect() function can return ERR_MEM if no memory is
|
||||
available for enqueueing the SYN segment. If the SYN indeed was
|
||||
enqueued successfully, the tcp_connect() function returns ERR_OK.
|
||||
|
||||
|
||||
|
||||
--- Sending TCP data
|
||||
|
||||
TCP data is sent by enqueueing the data with a call to
|
||||
@@ -216,19 +130,15 @@ tcp_write(). When the data is successfully transmitted to the remote
|
||||
host, the application will be notified with a call to a specified
|
||||
callback function.
|
||||
|
||||
- err_t tcp_write(struct tcp_pcb *pcb, const void *dataptr, u16_t len,
|
||||
u8_t apiflags)
|
||||
- err_t tcp_write(struct tcp_pcb *pcb, void *dataptr, u16_t len,
|
||||
u8_t copy)
|
||||
|
||||
Enqueues the data pointed to by the argument dataptr. The length of
|
||||
the data is passed as the len parameter. The apiflags can be one or more of:
|
||||
- TCP_WRITE_FLAG_COPY: indicates whether the new memory should be allocated
|
||||
for the data to be copied into. If this flag is not given, no new memory
|
||||
should be allocated and the data should only be referenced by pointer. This
|
||||
also means that the memory behind dataptr must not change until the data is
|
||||
ACKed by the remote host
|
||||
- TCP_WRITE_FLAG_MORE: indicates that more data follows. If this is omitted,
|
||||
the PSH flag is set in the last segment created by this call to tcp_write.
|
||||
If this flag is given, the PSH flag is not set.
|
||||
the data is passed as the len parameter. The copy argument is either
|
||||
0 or 1 and indicates whether the new memory should be allocated for
|
||||
the data to be copied into. If the argument is 0, no new memory
|
||||
should be allocated and the data should only be referenced by
|
||||
pointer.
|
||||
|
||||
The tcp_write() function will fail and return ERR_MEM if the length
|
||||
of the data exceeds the current send buffer size or if the length of
|
||||
@@ -243,7 +153,7 @@ callback function.
|
||||
|
||||
- void tcp_sent(struct tcp_pcb *pcb,
|
||||
err_t (* sent)(void *arg, struct tcp_pcb *tpcb,
|
||||
u16_t len))
|
||||
u16_t len))
|
||||
|
||||
Specifies the callback function that should be called when data has
|
||||
successfully been received (i.e., acknowledged) by the remote
|
||||
@@ -265,16 +175,13 @@ window.
|
||||
|
||||
Sets the callback function that will be called when new data
|
||||
arrives. The callback function will be passed a NULL pbuf to
|
||||
indicate that the remote host has closed the connection. If
|
||||
there are no errors and the callback function is to return
|
||||
ERR_OK, then it must free the pbuf. Otherwise, it must not
|
||||
free the pbuf so that lwIP core code can store it.
|
||||
indicate that the remote host has closed the connection.
|
||||
|
||||
- void tcp_recved(struct tcp_pcb *pcb, u16_t len)
|
||||
|
||||
Must be called when the application has received the data. The len
|
||||
argument indicates the length of the received data.
|
||||
|
||||
|
||||
|
||||
--- Application polling
|
||||
|
||||
@@ -287,9 +194,8 @@ if a call to tcp_write() has failed because memory wasn't available,
|
||||
the application may use the polling functionality to call tcp_write()
|
||||
again when the connection has been idle for a while.
|
||||
|
||||
- void tcp_poll(struct tcp_pcb *pcb,
|
||||
err_t (* poll)(void *arg, struct tcp_pcb *tpcb),
|
||||
u8_t interval)
|
||||
- void tcp_poll(struct tcp_pcb *pcb, u8_t interval,
|
||||
err_t (* poll)(void *arg, struct tcp_pcb *tpcb))
|
||||
|
||||
Specifies the polling interval and the callback function that should
|
||||
be called to poll the application. The interval is specified in
|
||||
@@ -315,23 +221,29 @@ again when the connection has been idle for a while.
|
||||
Aborts the connection by sending a RST (reset) segment to the remote
|
||||
host. The pcb is deallocated. This function never fails.
|
||||
|
||||
ATTENTION: When calling this from one of the TCP callbacks, make
|
||||
sure you always return ERR_ABRT (and never return ERR_ABRT otherwise
|
||||
or you will risk accessing deallocated memory or memory leaks!
|
||||
|
||||
|
||||
If a connection is aborted because of an error, the application is
|
||||
alerted of this event by the err callback. Errors that might abort a
|
||||
connection are when there is a shortage of memory. The callback
|
||||
function to be called is set using the tcp_err() function.
|
||||
|
||||
- void tcp_err(struct tcp_pcb *pcb, void (* err)(void *arg,
|
||||
err_t err))
|
||||
err_t err))
|
||||
|
||||
The error callback function does not get the pcb passed to it as a
|
||||
parameter since the pcb may already have been deallocated.
|
||||
|
||||
|
||||
--- Lower layer TCP interface
|
||||
|
||||
TCP provides a simple interface to the lower layers of the
|
||||
system. During system initialization, the function tcp_init() has
|
||||
to be called before any other TCP function is called. When the system
|
||||
is running, the two timer functions tcp_fasttmr() and tcp_slowtmr()
|
||||
must be called with regular intervals. The tcp_fasttmr() should be
|
||||
called every TCP_FAST_INTERVAL milliseconds (defined in tcp.h) and
|
||||
tcp_slowtmr() should be called every TCP_SLOW_INTERVAL milliseconds.
|
||||
|
||||
|
||||
--- UDP interface
|
||||
|
||||
The UDP interface is similar to that of TCP, but due to the lower
|
||||
@@ -347,14 +259,14 @@ level of complexity of UDP, the interface is significantly simpler.
|
||||
|
||||
Removes and deallocates the pcb.
|
||||
|
||||
- err_t udp_bind(struct udp_pcb *pcb, ip_addr_t *ipaddr,
|
||||
- err_t udp_bind(struct udp_pcb *pcb, struct ip_addr *ipaddr,
|
||||
u16_t port)
|
||||
|
||||
Binds the pcb to a local address. The IP-address argument "ipaddr"
|
||||
can be IP_ADDR_ANY to indicate that it should listen to any local IP
|
||||
address. The function currently always return ERR_OK.
|
||||
|
||||
- err_t udp_connect(struct udp_pcb *pcb, ip_addr_t *ipaddr,
|
||||
- err_t udp_connect(struct udp_pcb *pcb, struct ip_addr *ipaddr,
|
||||
u16_t port)
|
||||
|
||||
Sets the remote end of the pcb. This function does not generate any
|
||||
@@ -372,135 +284,9 @@ level of complexity of UDP, the interface is significantly simpler.
|
||||
- void udp_recv(struct udp_pcb *pcb,
|
||||
void (* recv)(void *arg, struct udp_pcb *upcb,
|
||||
struct pbuf *p,
|
||||
ip_addr_t *addr,
|
||||
struct ip_addr *addr,
|
||||
u16_t port),
|
||||
void *recv_arg)
|
||||
|
||||
Specifies a callback function that should be called when a UDP
|
||||
datagram is received.
|
||||
|
||||
|
||||
--- System initalization
|
||||
|
||||
A truly complete and generic sequence for initializing the lwIP stack
|
||||
cannot be given because it depends on additional initializations for
|
||||
your runtime environment (e.g. timers).
|
||||
|
||||
We can give you some idea on how to proceed when using the raw API.
|
||||
We assume a configuration using a single Ethernet netif and the
|
||||
UDP and TCP transport layers, IPv4 and the DHCP client.
|
||||
|
||||
Call these functions in the order of appearance:
|
||||
|
||||
- lwip_init()
|
||||
|
||||
Initialize the lwIP stack and all of its subsystems.
|
||||
|
||||
- netif_add(struct netif *netif, const ip4_addr_t *ipaddr,
|
||||
const ip4_addr_t *netmask, const ip4_addr_t *gw,
|
||||
void *state, netif_init_fn init, netif_input_fn input)
|
||||
|
||||
Adds your network interface to the netif_list. Allocate a struct
|
||||
netif and pass a pointer to this structure as the first argument.
|
||||
Give pointers to cleared ip_addr structures when using DHCP,
|
||||
or fill them with sane numbers otherwise. The state pointer may be NULL.
|
||||
|
||||
The init function pointer must point to a initialization function for
|
||||
your Ethernet netif interface. The following code illustrates its use.
|
||||
|
||||
err_t netif_if_init(struct netif *netif)
|
||||
{
|
||||
u8_t i;
|
||||
|
||||
for (i = 0; i < ETHARP_HWADDR_LEN; i++) {
|
||||
netif->hwaddr[i] = some_eth_addr[i];
|
||||
}
|
||||
init_my_eth_device();
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
For Ethernet drivers, the input function pointer must point to the lwIP
|
||||
function ethernet_input() declared in "netif/etharp.h". Other drivers
|
||||
must use ip_input() declared in "lwip/ip.h".
|
||||
|
||||
- netif_set_default(struct netif *netif)
|
||||
|
||||
Registers the default network interface.
|
||||
|
||||
- netif_set_link_up(struct netif *netif)
|
||||
|
||||
This is the hardware link state; e.g. whether cable is plugged for wired
|
||||
Ethernet interface. This function must be called even if you don't know
|
||||
the current state. Having link up and link down events is optional but
|
||||
DHCP and IPv6 discover benefit well from those events.
|
||||
|
||||
- netif_set_up(struct netif *netif)
|
||||
|
||||
This is the administrative (= software) state of the netif, when the
|
||||
netif is fully configured this function must be called.
|
||||
|
||||
- dhcp_start(struct netif *netif)
|
||||
|
||||
Creates a new DHCP client for this interface on the first call.
|
||||
|
||||
You can peek in the netif->dhcp struct for the actual DHCP status.
|
||||
|
||||
- sys_check_timeouts()
|
||||
|
||||
When the system is running, you have to periodically call
|
||||
sys_check_timeouts() which will handle all timers for all protocols in
|
||||
the stack; add this to your main loop or equivalent.
|
||||
|
||||
|
||||
--- Optimalization hints
|
||||
|
||||
The first thing you want to optimize is the lwip_standard_checksum()
|
||||
routine from src/core/inet.c. You can override this standard
|
||||
function with the #define LWIP_CHKSUM <your_checksum_routine>.
|
||||
|
||||
There are C examples given in inet.c or you might want to
|
||||
craft an assembly function for this. RFC1071 is a good
|
||||
introduction to this subject.
|
||||
|
||||
Other significant improvements can be made by supplying
|
||||
assembly or inline replacements for htons() and htonl()
|
||||
if you're using a little-endian architecture.
|
||||
#define LWIP_PLATFORM_BYTESWAP 1
|
||||
#define LWIP_PLATFORM_HTONS(x) <your_htons>
|
||||
#define LWIP_PLATFORM_HTONL(x) <your_htonl>
|
||||
|
||||
Check your network interface driver if it reads at
|
||||
a higher speed than the maximum wire-speed. If the
|
||||
hardware isn't serviced frequently and fast enough
|
||||
buffer overflows are likely to occur.
|
||||
|
||||
E.g. when using the cs8900 driver, call cs8900if_service(ethif)
|
||||
as frequently as possible. When using an RTOS let the cs8900 interrupt
|
||||
wake a high priority task that services your driver using a binary
|
||||
semaphore or event flag. Some drivers might allow additional tuning
|
||||
to match your application and network.
|
||||
|
||||
For a production release it is recommended to set LWIP_STATS to 0.
|
||||
Note that speed performance isn't influenced much by simply setting
|
||||
high values to the memory options.
|
||||
|
||||
For more optimization hints take a look at the lwIP wiki.
|
||||
|
||||
--- Zero-copy MACs
|
||||
|
||||
To achieve zero-copy on transmit, the data passed to the raw API must
|
||||
remain unchanged until sent. Because the send- (or write-)functions return
|
||||
when the packets have been enqueued for sending, data must be kept stable
|
||||
after that, too.
|
||||
|
||||
This implies that PBUF_RAM/PBUF_POOL pbufs passed to raw-API send functions
|
||||
must *not* be reused by the application unless their ref-count is 1.
|
||||
|
||||
For no-copy pbufs (PBUF_ROM/PBUF_REF), data must be kept unchanged, too,
|
||||
but the stack/driver will/must copy PBUF_REF'ed data when enqueueing, while
|
||||
PBUF_ROM-pbufs are just enqueued (as ROM-data is expected to never change).
|
||||
|
||||
Also, data passed to tcp_write without the copy-flag must not be changed!
|
||||
|
||||
Therefore, be careful which type of PBUF you use and if you copy TCP data
|
||||
or not!
|
||||
datagram is received.
|
||||
157
doc/savannah.txt
157
doc/savannah.txt
@@ -2,34 +2,42 @@ Daily Use Guide for using Savannah for lwIP
|
||||
|
||||
Table of Contents:
|
||||
|
||||
1 - Obtaining lwIP from the Git repository
|
||||
2 - Committers/developers Git access using SSH
|
||||
3 - Merging a development branch to master branch
|
||||
1 - Obtaining lwIP from the CVS repository
|
||||
2 - Committers/developers CVS access using SSH (to be written)
|
||||
3 - Merging from DEVEL branch to main trunk (stable branch)
|
||||
4 - How to release lwIP
|
||||
|
||||
|
||||
|
||||
1 Obtaining lwIP from the Git repository
|
||||
1 Obtaining lwIP from the CVS repository
|
||||
----------------------------------------
|
||||
|
||||
To perform an anonymous Git clone of the master branch (this is where
|
||||
To perform an anonymous CVS checkout of the main trunk (this is where
|
||||
bug fixes and incremental enhancements occur), do this:
|
||||
git clone git://git.savannah.nongnu.org/lwip.git
|
||||
|
||||
export CVS_RSH=ssh
|
||||
cvs -d:ext:anoncvs@subversions.gnu.org:/cvsroot/lwip checkout lwip
|
||||
|
||||
(If SSH asks about authenticity of the host, you can check the key
|
||||
fingerprint against http://savannah.nongnu.org/cvs/?group=lwip)
|
||||
|
||||
Or, obtain a stable branch (updated with bug fixes only) as follows:
|
||||
git clone --branch DEVEL-1_4_1 git://git.savannah.nongnu.org/lwip.git
|
||||
cvs -d:ext:anoncvs@subversions.gnu.org:/cvsroot/lwip checkout -r STABLE-0_7 -d lwip-0.7 lwip
|
||||
|
||||
Or, obtain a specific (fixed) release as follows:
|
||||
git clone --branch STABLE-1_4_1 git://git.savannah.nongnu.org/lwip.git
|
||||
cvs -d:ext:anoncvs@subversions.gnu.org:/cvsroot/lwip checkout -r STABLE-0_7_0 -d lwip-0.7.0 lwip
|
||||
|
||||
Or, obtain a development branch (considered unstable!) as follows:
|
||||
cvs -d:ext:anoncvs@subversions.gnu.org:/cvsroot/lwip checkout -r DEVEL -d lwip-DEVEL lwip
|
||||
|
||||
2 Committers/developers Git access using SSH
|
||||
3 Committers/developers CVS access using SSH
|
||||
--------------------------------------------
|
||||
|
||||
The Savannah server uses SSH (Secure Shell) protocol 2 authentication and encryption.
|
||||
As such, Git commits to the server occur through a SSH tunnel for project members.
|
||||
As such, CVS commits to the server occur through a SSH tunnel for project members.
|
||||
To create a SSH2 key pair in UNIX-like environments, do this:
|
||||
ssh-keygen -t dsa
|
||||
|
||||
ssh-keygen -t dsa
|
||||
|
||||
Under Windows, a recommended SSH client is "PuTTY", freely available with good
|
||||
documentation and a graphic user interface. Use its key generator.
|
||||
@@ -38,83 +46,112 @@ Now paste the id_dsa.pub contents into your Savannah account public key list. Wa
|
||||
a while so that Savannah can update its configuration (This can take minutes).
|
||||
|
||||
Try to login using SSH:
|
||||
ssh -v your_login@git.sv.gnu.org
|
||||
|
||||
ssh -v your_login@subversions.gnu.org
|
||||
|
||||
If it tells you:
|
||||
Linux vcs.savannah.gnu.org 2.6.32-5-xen-686 #1 SMP Wed Jun 17 17:10:03 UTC 2015 i686
|
||||
|
||||
Interactive shell login is not possible for security reasons.
|
||||
VCS commands are allowed.
|
||||
Last login: Tue May 15 23:10:12 2012 from 82.245.102.129
|
||||
You tried to execute:
|
||||
Sorry, you are not allowed to execute that command.
|
||||
Shared connection to git.sv.gnu.org closed.
|
||||
Authenticating with public key "your_key_name"...
|
||||
Server refused to allocate pty
|
||||
|
||||
then you could login; Savannah refuses to give you a shell - which is OK, as we
|
||||
are allowed to use SSH for Git only. Now, you should be able to do this:
|
||||
git clone your_login@git.sv.gnu.org:/srv/git/lwip.git
|
||||
are allowed to use SSH for CVS only. Now, you should be able to do this:
|
||||
|
||||
After which you can edit your local files with bug fixes or new features and
|
||||
commit them. Make sure you know what you are doing when using Git to make
|
||||
export CVS_RSH=ssh
|
||||
cvs -d:ext:your_login@subversions.gnu.org:/cvsroot/lwip checkout lwip
|
||||
|
||||
after which you can edit your local files with bug fixes or new features and
|
||||
commit them. Make sure you know what you are doing when using CVS to make
|
||||
changes on the repository. If in doubt, ask on the lwip-members mailing list.
|
||||
|
||||
(If SSH asks about authenticity of the host, you can check the key
|
||||
fingerprint against https://savannah.nongnu.org/git/?group=lwip
|
||||
3 Merging from DEVEL branch to main trunk (stable)
|
||||
--------------------------------------------------
|
||||
|
||||
Merging is a delicate process in CVS and requires the
|
||||
following disciplined steps in order to prevent conflicts
|
||||
in the future. Conflicts can be hard to solve!
|
||||
|
||||
3 - Merging a development branch to master branch
|
||||
-------------------------------------------------
|
||||
Merging from branch A to branch B requires that the A branch
|
||||
has a tag indicating the previous merger. This tag is called
|
||||
'merged_from_A_to_B'. After merging, the tag is moved in the
|
||||
A branch to remember this merger for future merge actions.
|
||||
|
||||
Merging is a straightforward process in Git. How to merge all changes in a
|
||||
development branch since our last merge from main:
|
||||
IMPORTANT: AFTER COMMITTING A SUCCESFUL MERGE IN THE
|
||||
REPOSITORY, THE TAG MUST BE SET ON THE SOURCE BRANCH OF THE
|
||||
MERGE ACTION (REPLACING EXISTING TAGS WITH THE SAME NAME).
|
||||
|
||||
Checkout the master branch:
|
||||
git checkout master
|
||||
Merge all changes in DEVEL since our last merge to main:
|
||||
|
||||
Merge the development branch to master:
|
||||
git merge your-development-branch
|
||||
In the working copy of the main trunk:
|
||||
cvs update -P -jmerged_from_DEVEL_to_main -jDEVEL
|
||||
|
||||
Resolve any conflict.
|
||||
(This will apply the changes between 'merged_from_DEVEL_to_main'
|
||||
and 'DEVEL' to your work set of files)
|
||||
|
||||
Commit the merge result.
|
||||
git commit -a
|
||||
We can now commit the merge result.
|
||||
cvs commit -R -m "Merged from DEVEL to main."
|
||||
|
||||
Push your commits:
|
||||
git push
|
||||
If this worked out OK, we now move the tag in the DEVEL branch
|
||||
to this merge point, so we can use this point for future merges:
|
||||
|
||||
cvs rtag -F -r DEVEL merged_from_DEVEL_to_main lwip
|
||||
|
||||
4 How to release lwIP
|
||||
---------------------
|
||||
|
||||
First, tag the release using Git: (I use release number 1.4.1 throughout
|
||||
this example).
|
||||
git tag -a STABLE-1_4_1
|
||||
First, checkout a clean copy of the branch to be released. Tag this set with
|
||||
tag name "STABLE-0_6_3". (I use release number 0.6.3 throughout this example).
|
||||
|
||||
Share the tag reference by pushing it to remote:
|
||||
git push origin STABLE-1_4_1
|
||||
Login CVS using pserver authentication, then export a clean copy of the
|
||||
tagged tree. Export is similar to a checkout, except that the CVS metadata
|
||||
is not created locally.
|
||||
|
||||
Prepare the release:
|
||||
cp -r lwip lwip-1.4.1
|
||||
rm -rf lwip-1.4.1/.git lwip-1.4.1/.gitattributes
|
||||
export CVS_RSH=ssh
|
||||
cvs -d:ext:anoncvs@subversions.gnu.org:/cvsroot/lwip export -r STABLE-0_6_3 -d lwip-0.6.3 lwip
|
||||
|
||||
Archive the current directory using tar, gzip'd, bzip2'd and zip'd.
|
||||
tar czvf lwip-1.4.1.tar.gz lwip-1.4.1
|
||||
tar cjvf lwip-1.4.1.tar.bz2 lwip-1.4.1
|
||||
zip -r lwip-1.4.1.zip lwip-1.4.1
|
||||
Archive this directory using tar, gzip'd, bzip2'd and zip'd.
|
||||
|
||||
Now, sign the archives with a detached GPG binary signature as follows:
|
||||
gpg -b lwip-1.4.1.tar.gz
|
||||
gpg -b lwip-1.4.1.tar.bz2
|
||||
gpg -b lwip-1.4.1.zip
|
||||
tar czvf lwip-0.6.3.tar.gz lwip-0.6.3
|
||||
|
||||
Upload these files using anonymous FTP:
|
||||
ncftp ftp://savannah.gnu.org/incoming/savannah/lwip
|
||||
ncftp> mput *1.4.1.*
|
||||
First, make a local release directory to work in, I use "lwip-releases":
|
||||
|
||||
mkdir lwip-releases
|
||||
cd lwip-releases
|
||||
|
||||
Now, make a new release by creating a new directory for it (these are
|
||||
Savannah conventions so that it shows up in the Files list real nice):
|
||||
|
||||
mkdir stable.pkg
|
||||
mkdir stable.pkg 0.6.3
|
||||
|
||||
We can now copy the tar archive we made earlier into the release directory:
|
||||
|
||||
cp ../../../lwip-0.6.3.tar.gz .
|
||||
|
||||
Finally, synchronize this directory upwards to Savannah:
|
||||
|
||||
rsync -n -e "ssh -1" -t -u -v -r *.pkg likewise@savannah.nongnu.org:/upload/lwip
|
||||
|
||||
This does a "dry run": no files are modified! After you have confirmed that
|
||||
this is what you intended to do, remove "-n" and actually synchronize for
|
||||
real. The release should now be available here:
|
||||
|
||||
http://savannah.nongnu.org/files/?group=lwip
|
||||
|
||||
---
|
||||
Explanation of rsync options used:
|
||||
|
||||
-t: preserve file timestamps
|
||||
-u: do not overwrite existing files, unless they are older
|
||||
-v: be verbose (long format file attributes)
|
||||
-r: recurse into directories
|
||||
-n: dry-run, do not modify anything.
|
||||
---
|
||||
|
||||
Additionally, you may post a news item on Savannah, like this:
|
||||
|
||||
A new 1.4.1 release is now available here:
|
||||
http://savannah.nongnu.org/files/?group=lwip&highlight=1.4.1
|
||||
A new 0.6.3 release is now available here:
|
||||
http://savannah.nongnu.org/files/?group=lwip&highlight=0.6.3
|
||||
|
||||
You will have to submit this via the user News interface, then approve
|
||||
this via the Administrator News interface.
|
||||
this via the Administrator News interface.
|
||||
@@ -1,165 +0,0 @@
|
||||
SNMPv1 agent for lwIP
|
||||
|
||||
Author: Christiaan Simons
|
||||
|
||||
This is a brief introduction how to use and configure the SNMP agent.
|
||||
Note the agent uses the raw-API UDP interface so you may also want to
|
||||
read rawapi.txt to gain a better understanding of the SNMP message handling.
|
||||
|
||||
0 Agent Capabilities
|
||||
====================
|
||||
|
||||
SNMPv1 per RFC1157
|
||||
This is an old(er) standard but is still widely supported.
|
||||
For SNMPv2c and v3 have a greater complexity and need many
|
||||
more lines of code. IMHO this breaks the idea of "lightweight IP".
|
||||
|
||||
Note the S in SNMP stands for "Simple". Note that "Simple" is
|
||||
relative. SNMP is simple compared to the complex ISO network
|
||||
management protocols CMIP (Common Management Information Protocol)
|
||||
and CMOT (CMip Over Tcp).
|
||||
|
||||
MIB II per RFC1213
|
||||
The standard lwIP stack management information base.
|
||||
This is a required MIB, so this is always enabled.
|
||||
When builing lwIP without TCP, the mib-2.tcp group is omitted.
|
||||
The groups EGP, CMOT and transmission are disabled by default.
|
||||
|
||||
Most mib-2 objects are not writable except:
|
||||
sysName, sysLocation, sysContact, snmpEnableAuthenTraps.
|
||||
Writing to or changing the ARP and IP address and route
|
||||
tables is not possible.
|
||||
|
||||
Note lwIP has a very limited notion of IP routing. It currently
|
||||
doen't have a route table and doesn't have a notion of the U,G,H flags.
|
||||
Instead lwIP uses the interface list with only one default interface
|
||||
acting as a single gateway interface (G) for the default route.
|
||||
|
||||
The agent returns a "virtual table" with the default route 0.0.0.0
|
||||
for the default interface and network routes (no H) for each
|
||||
network interface in the netif_list.
|
||||
All routes are considered to be up (U).
|
||||
|
||||
Loading additional MIBs
|
||||
MIBs can only be added in compile-time, not in run-time.
|
||||
There is no MIB compiler thus additional MIBs must be hand coded.
|
||||
|
||||
Large SNMP message support
|
||||
The packet decoding and encoding routines are designed
|
||||
to use pbuf-chains. Larger payloads than the minimum
|
||||
SNMP requirement of 484 octets are supported if the
|
||||
PBUF_POOL_SIZE and IP_REASS_BUFSIZE are set to match your
|
||||
local requirement.
|
||||
|
||||
1 Building the Agent
|
||||
====================
|
||||
|
||||
First of all you'll need to add the following define
|
||||
to your local lwipopts.h:
|
||||
|
||||
#define LWIP_SNMP 1
|
||||
|
||||
and add the source files in lwip/src/core/snmp
|
||||
and some snmp headers in lwip/src/include/lwip to your makefile.
|
||||
|
||||
Note you'll might need to adapt you network driver to update
|
||||
the mib2 variables for your interface.
|
||||
|
||||
2 Running the Agent
|
||||
===================
|
||||
|
||||
The following function calls must be made in your program to
|
||||
actually get the SNMP agent running.
|
||||
|
||||
Before starting the agent you should supply pointers
|
||||
to non-volatile memory for sysContact, sysLocation,
|
||||
and snmpEnableAuthenTraps. You can do this by calling
|
||||
|
||||
snmp_set_syscontact()
|
||||
snmp_set_syslocation()
|
||||
snmp_set_snmpenableauthentraps()
|
||||
|
||||
Additionally you may want to set
|
||||
|
||||
snmp_set_sysdescr()
|
||||
snmp_set_sysobjid() (if you have a private MIB)
|
||||
snmp_set_sysname()
|
||||
|
||||
Also before starting the agent you need to setup
|
||||
one or more trap destinations using these calls:
|
||||
|
||||
snmp_trap_dst_enable();
|
||||
snmp_trap_dst_ip_set();
|
||||
|
||||
|
||||
3 Private MIBs
|
||||
==============
|
||||
|
||||
If want to extend the agent with your own private MIB you'll need to
|
||||
add the following define to your local lwipopts.h:
|
||||
|
||||
#define SNMP_PRIVATE_MIB 1
|
||||
|
||||
You must provide the private_mib.h and associated files yourself.
|
||||
Note we don't have a "MIB compiler" that generates C source from a MIB,
|
||||
so you're required to do some serious coding if you enable this!
|
||||
|
||||
Note the lwIP enterprise ID (26381) is assigned to the lwIP project,
|
||||
ALL OBJECT IDENTIFIERS LIVING UNDER THIS ID ARE ASSIGNED BY THE lwIP
|
||||
MAINTAINERS!
|
||||
|
||||
If you need to create your own private MIB you'll need
|
||||
to apply for your own enterprise ID with IANA: http://www.iana.org/numbers.html
|
||||
|
||||
You can set it by passing a struct snmp_obj_id to the agent
|
||||
using snmp_set_sysobjid(&my_object_id), just before snmp_init().
|
||||
|
||||
Note the object identifiers for thes MIB-2 and your private MIB
|
||||
tree must be kept in sorted ascending (lexicographical) order.
|
||||
This to ensure correct getnext operation.
|
||||
|
||||
An example for a private MIB is part of the "minimal Unix" project:
|
||||
contrib/ports/unix/proj/minimal/lwip_prvmib.c
|
||||
|
||||
The next chapter gives a more detailed description of the
|
||||
MIB-2 tree and the optional private MIB.
|
||||
|
||||
4 The Gory Details
|
||||
==================
|
||||
|
||||
4.0 Object identifiers and the MIB tree.
|
||||
|
||||
We have three distinct parts for all object identifiers:
|
||||
|
||||
The prefix
|
||||
.iso.org.dod.internet
|
||||
|
||||
the middle part
|
||||
.mgmt.mib-2.ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaPhysAddress
|
||||
|
||||
and the index part
|
||||
.1.192.168.0.1
|
||||
|
||||
Objects located above the .internet hierarchy aren't supported.
|
||||
Currently only the .mgmt sub-tree is available and
|
||||
when the SNMP_PRIVATE_MIB is enabled the .private tree
|
||||
becomes available too.
|
||||
|
||||
Object identifiers from incoming requests are checked
|
||||
for a matching prefix, middle part and index part
|
||||
or are expanded(*) for GetNext requests with short
|
||||
or inexisting names in the request.
|
||||
(* we call this "expansion" but this also
|
||||
resembles the "auto-completion" operation)
|
||||
|
||||
The middle part is usually located in ROM (const)
|
||||
to preserve precious RAM on small microcontrollers.
|
||||
However RAM location is possible for a dynamically
|
||||
changing private tree.
|
||||
|
||||
The index part is handled by functions which in
|
||||
turn use dynamically allocated index trees from RAM.
|
||||
These trees are updated by e.g. the etharp code
|
||||
when new entries are made or removed form the ARP cache.
|
||||
|
||||
/** @todo more gory details */
|
||||
133
doc/sys_arch.txt
133
doc/sys_arch.txt
@@ -34,42 +34,31 @@ in the sys_arch.h file. Mailboxes are equivalently represented by the
|
||||
type "sys_mbox_t". lwIP does not place any restrictions on how
|
||||
sys_sem_t or sys_mbox_t are represented internally.
|
||||
|
||||
Since lwIP 1.4.0, semaphore and mailbox functions are prototyped in a way that
|
||||
allows both using pointers or actual OS structures to be used. This way, memory
|
||||
required for such types can be either allocated in place (globally or on the
|
||||
stack) or on the heap (allocated internally in the "*_new()" functions).
|
||||
|
||||
The following functions must be implemented by the sys_arch:
|
||||
|
||||
- void sys_init(void)
|
||||
|
||||
Is called to initialize the sys_arch layer.
|
||||
|
||||
- err_t sys_sem_new(sys_sem_t *sem, u8_t count)
|
||||
- sys_sem_t sys_sem_new(u8_t count)
|
||||
|
||||
Creates a new semaphore. The semaphore is allocated to the memory that 'sem'
|
||||
points to (which can be both a pointer or the actual OS structure).
|
||||
The "count" argument specifies the initial state of the semaphore (which is
|
||||
either 0 or 1).
|
||||
If the semaphore has been created, ERR_OK should be returned. Returning any
|
||||
other error will provide a hint what went wrong, but except for assertions,
|
||||
no real error handling is implemented.
|
||||
Creates and returns a new semaphore. The "count" argument specifies
|
||||
the initial state of the semaphore.
|
||||
|
||||
- void sys_sem_free(sys_sem_t *sem)
|
||||
- void sys_sem_free(sys_sem_t sem)
|
||||
|
||||
Deallocates a semaphore.
|
||||
|
||||
- void sys_sem_signal(sys_sem_t *sem)
|
||||
- void sys_sem_signal(sys_sem_t sem)
|
||||
|
||||
Signals a semaphore.
|
||||
|
||||
- u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout)
|
||||
- u32_t sys_arch_sem_wait(sys_sem_t sem, u32_t timeout)
|
||||
|
||||
Blocks the thread while waiting for the semaphore to be
|
||||
signaled. If the "timeout" argument is non-zero, the thread should
|
||||
only be blocked for the specified time (measured in
|
||||
milliseconds). If the "timeout" argument is zero, the thread should be
|
||||
blocked until the semaphore is signalled.
|
||||
milliseconds).
|
||||
|
||||
If the timeout argument is non-zero, the return value is the number of
|
||||
milliseconds spent waiting for the semaphore to be signaled. If the
|
||||
@@ -80,52 +69,25 @@ The following functions must be implemented by the sys_arch:
|
||||
Notice that lwIP implements a function with a similar name,
|
||||
sys_sem_wait(), that uses the sys_arch_sem_wait() function.
|
||||
|
||||
- int sys_sem_valid(sys_sem_t *sem)
|
||||
- sys_mbox_t sys_mbox_new(void)
|
||||
|
||||
Returns 1 if the semaphore is valid, 0 if it is not valid.
|
||||
When using pointers, a simple way is to check the pointer for != NULL.
|
||||
When directly using OS structures, implementing this may be more complex.
|
||||
This may also be a define, in which case the function is not prototyped.
|
||||
Creates an empty mailbox.
|
||||
|
||||
- void sys_sem_set_invalid(sys_sem_t *sem)
|
||||
|
||||
Invalidate a semaphore so that sys_sem_valid() returns 0.
|
||||
ATTENTION: This does NOT mean that the semaphore shall be deallocated:
|
||||
sys_sem_free() is always called before calling this function!
|
||||
This may also be a define, in which case the function is not prototyped.
|
||||
|
||||
- err_t sys_mbox_new(sys_mbox_t *mbox, int size)
|
||||
|
||||
Creates an empty mailbox for maximum "size" elements. Elements stored
|
||||
in mailboxes are pointers. You have to define macros "_MBOX_SIZE"
|
||||
in your lwipopts.h, or ignore this parameter in your implementation
|
||||
and use a default size.
|
||||
If the mailbox has been created, ERR_OK should be returned. Returning any
|
||||
other error will provide a hint what went wrong, but except for assertions,
|
||||
no real error handling is implemented.
|
||||
|
||||
- void sys_mbox_free(sys_mbox_t *mbox)
|
||||
- void sys_mbox_free(sys_mbox_t mbox)
|
||||
|
||||
Deallocates a mailbox. If there are messages still present in the
|
||||
mailbox when the mailbox is deallocated, it is an indication of a
|
||||
programming error in lwIP and the developer should be notified.
|
||||
|
||||
- void sys_mbox_post(sys_mbox_t *mbox, void *msg)
|
||||
- void sys_mbox_post(sys_mbox_t mbox, void *msg)
|
||||
|
||||
Posts the "msg" to the mailbox. This function have to block until
|
||||
the "msg" is really posted.
|
||||
Posts the "msg" to the mailbox.
|
||||
|
||||
- err_t sys_mbox_trypost(sys_mbox_t *mbox, void *msg)
|
||||
|
||||
Try to post the "msg" to the mailbox. Returns ERR_MEM if this one
|
||||
is full, else, ERR_OK if the "msg" is posted.
|
||||
|
||||
- u32_t sys_arch_mbox_fetch(sys_mbox_t *mbox, void **msg, u32_t timeout)
|
||||
- u32_t sys_arch_mbox_fetch(sys_mbox_t mbox, void **msg, u32_t timeout)
|
||||
|
||||
Blocks the thread until a message arrives in the mailbox, but does
|
||||
not block the thread longer than "timeout" milliseconds (similar to
|
||||
the sys_arch_sem_wait() function). If "timeout" is 0, the thread should
|
||||
be blocked until a message arrives. The "msg" argument is a result
|
||||
the sys_arch_sem_wait() function). The "msg" argument is a result
|
||||
parameter that is set by the function (i.e., by doing "*msg =
|
||||
ptr"). The "msg" parameter maybe NULL to indicate that the message
|
||||
should be dropped.
|
||||
@@ -136,45 +98,29 @@ The following functions must be implemented by the sys_arch:
|
||||
|
||||
Note that a function with a similar name, sys_mbox_fetch(), is
|
||||
implemented by lwIP.
|
||||
|
||||
- struct sys_timeouts *sys_arch_timeouts(void)
|
||||
|
||||
- u32_t sys_arch_mbox_tryfetch(sys_mbox_t *mbox, void **msg)
|
||||
|
||||
This is similar to sys_arch_mbox_fetch, however if a message is not
|
||||
present in the mailbox, it immediately returns with the code
|
||||
SYS_MBOX_EMPTY. On success 0 is returned.
|
||||
|
||||
To allow for efficient implementations, this can be defined as a
|
||||
function-like macro in sys_arch.h instead of a normal function. For
|
||||
example, a naive implementation could be:
|
||||
#define sys_arch_mbox_tryfetch(mbox,msg) \
|
||||
sys_arch_mbox_fetch(mbox,msg,1)
|
||||
although this would introduce unnecessary delays.
|
||||
|
||||
- int sys_mbox_valid(sys_mbox_t *mbox)
|
||||
|
||||
Returns 1 if the mailbox is valid, 0 if it is not valid.
|
||||
When using pointers, a simple way is to check the pointer for != NULL.
|
||||
When directly using OS structures, implementing this may be more complex.
|
||||
This may also be a define, in which case the function is not prototyped.
|
||||
|
||||
- void sys_mbox_set_invalid(sys_mbox_t *mbox)
|
||||
|
||||
Invalidate a mailbox so that sys_mbox_valid() returns 0.
|
||||
ATTENTION: This does NOT mean that the mailbox shall be deallocated:
|
||||
sys_mbox_free() is always called before calling this function!
|
||||
This may also be a define, in which case the function is not prototyped.
|
||||
Returns a pointer to the per-thread sys_timeouts structure. In lwIP,
|
||||
each thread has a list of timeouts which is repressented as a linked
|
||||
list of sys_timeout structures. The sys_timeouts structure holds a
|
||||
pointer to a linked list of timeouts. This function is called by
|
||||
the lwIP timeout scheduler and must not return a NULL value.
|
||||
|
||||
In a single threadd sys_arch implementation, this function will
|
||||
simply return a pointer to a global sys_timeouts variable stored in
|
||||
the sys_arch module.
|
||||
|
||||
If threads are supported by the underlying operating system and if
|
||||
such functionality is needed in lwIP, the following function will have
|
||||
to be implemented as well:
|
||||
|
||||
- sys_thread_t sys_thread_new(char *name, void (* thread)(void *arg), void *arg, int stacksize, int prio)
|
||||
- sys_thread_t sys_thread_new(void (* thread)(void *arg), void *arg, int prio)
|
||||
|
||||
Starts a new thread named "name" with priority "prio" that will begin its
|
||||
execution in the function "thread()". The "arg" argument will be passed as an
|
||||
argument to the thread() function. The stack size to used for this thread is
|
||||
the "stacksize" parameter. The id of the new thread is returned. Both the id
|
||||
and the priority are system dependent.
|
||||
Starts a new thread with priority "prio" that will begin its execution in the
|
||||
function "thread()". The "arg" argument will be passed as an argument to the
|
||||
thread() function. The id of the new thread is returned. Both the id and
|
||||
the priority are system dependent.
|
||||
|
||||
- sys_prot_t sys_arch_protect(void)
|
||||
|
||||
@@ -197,23 +143,6 @@ to be implemented as well:
|
||||
more information. This function is only required if your port is supporting
|
||||
an operating system.
|
||||
|
||||
For some configurations, you also need:
|
||||
|
||||
- u32_t sys_now(void)
|
||||
|
||||
This optional function returns the current time in milliseconds (don't care
|
||||
for wraparound, this is only used for time diffs).
|
||||
Not implementing this function means you cannot use some modules (e.g. TCP
|
||||
timestamps, internal timeouts for NO_SYS==1).
|
||||
|
||||
|
||||
Note:
|
||||
|
||||
Be carefull with using mem_malloc() in sys_arch. When malloc() refers to
|
||||
mem_malloc() you can run into a circular function call problem. In mem.c
|
||||
mem_init() tries to allcate a semaphore using mem_malloc, which of course
|
||||
can't be performed when sys_arch uses mem_malloc.
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Additional files required for the "OS support" emulation layer:
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -234,8 +163,6 @@ cc.h - Architecture environment, some compiler specific, some
|
||||
Platform specific diagnostic output -
|
||||
LWIP_PLATFORM_DIAG(x) - non-fatal, print a message.
|
||||
LWIP_PLATFORM_ASSERT(x) - fatal, print message and abandon execution.
|
||||
Portability defines for printf formatters:
|
||||
U16_F, S16_F, X16_F, U32_F, S32_F, X32_F, SZT_F
|
||||
|
||||
"lightweight" synchronization mechanisms -
|
||||
SYS_ARCH_DECL_PROTECT(x) - declare a protection state variable.
|
||||
|
||||
12
src/FILES
12
src/FILES
@@ -1,13 +1,11 @@
|
||||
api/ - The code for the high-level wrapper API. Not needed if
|
||||
you use the lowel-level call-back/raw API.
|
||||
|
||||
core/ - The core of the TPC/IP stack; protocol implementations,
|
||||
memory and buffer management, and the low-level raw API.
|
||||
api/ - The code for the API.
|
||||
|
||||
core/ - The core files including protocol implementations, memory
|
||||
and buffer management etc.
|
||||
|
||||
include/ - lwIP include files.
|
||||
|
||||
netif/ - Generic network interface device drivers are kept here,
|
||||
as well as the ARP module.
|
||||
netif/ - Generic network interface device drivers are kept here.
|
||||
|
||||
For more information on the various subdirectories, check the FILES
|
||||
file in each directory.
|
||||
|
||||
167
src/Filelists.mk
167
src/Filelists.mk
@@ -1,167 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2001, 2002 Swedish Institute of Computer Science.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
# SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
# OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
# OF SUCH DAMAGE.
|
||||
#
|
||||
# This file is part of the lwIP TCP/IP stack.
|
||||
#
|
||||
# Author: Adam Dunkels <adam@sics.se>
|
||||
#
|
||||
|
||||
# COREFILES, CORE4FILES: The minimum set of files needed for lwIP.
|
||||
COREFILES=$(LWIPDIR)/core/def.c \
|
||||
$(LWIPDIR)/core/dns.c \
|
||||
$(LWIPDIR)/core/inet_chksum.c \
|
||||
$(LWIPDIR)/core/init.c \
|
||||
$(LWIPDIR)/core/ip.c \
|
||||
$(LWIPDIR)/core/mem.c \
|
||||
$(LWIPDIR)/core/memp.c \
|
||||
$(LWIPDIR)/core/netif.c \
|
||||
$(LWIPDIR)/core/pbuf.c \
|
||||
$(LWIPDIR)/core/raw.c \
|
||||
$(LWIPDIR)/core/stats.c \
|
||||
$(LWIPDIR)/core/sys.c \
|
||||
$(LWIPDIR)/core/tcp.c \
|
||||
$(LWIPDIR)/core/tcp_in.c \
|
||||
$(LWIPDIR)/core/tcp_out.c \
|
||||
$(LWIPDIR)/core/timers.c \
|
||||
$(LWIPDIR)/core/udp.c
|
||||
|
||||
CORE4FILES=$(LWIPDIR)/core/ipv4/autoip.c \
|
||||
$(LWIPDIR)/core/ipv4/dhcp.c \
|
||||
$(LWIPDIR)/core/ipv4/icmp.c \
|
||||
$(LWIPDIR)/core/ipv4/igmp.c \
|
||||
$(LWIPDIR)/core/ipv4/ip_frag.c \
|
||||
$(LWIPDIR)/core/ipv4/ip4.c \
|
||||
$(LWIPDIR)/core/ipv4/ip4_addr.c
|
||||
|
||||
CORE6FILES=$(LWIPDIR)/core/ipv6/dhcp6.c \
|
||||
$(LWIPDIR)/core/ipv6/ethip6.c \
|
||||
$(LWIPDIR)/core/ipv6/icmp6.c \
|
||||
$(LWIPDIR)/core/ipv6/ip6.c \
|
||||
$(LWIPDIR)/core/ipv6/ip6_addr.c \
|
||||
$(LWIPDIR)/core/ipv6/ip6_frag.c \
|
||||
$(LWIPDIR)/core/ipv6/mld6.c \
|
||||
$(LWIPDIR)/core/ipv6/nd6.c
|
||||
|
||||
# APIFILES: The files which implement the sequential and socket APIs.
|
||||
APIFILES=$(LWIPDIR)/api/api_lib.c \
|
||||
$(LWIPDIR)/api/api_msg.c \
|
||||
$(LWIPDIR)/api/err.c \
|
||||
$(LWIPDIR)/api/netbuf.c \
|
||||
$(LWIPDIR)/api/netdb.c \
|
||||
$(LWIPDIR)/api/netifapi.c \
|
||||
$(LWIPDIR)/api/sockets.c \
|
||||
$(LWIPDIR)/api/tcpip.c
|
||||
|
||||
# NETIFFILES: Files implementing various generic network interface functions
|
||||
NETIFFILES=$(LWIPDIR)/netif/ethernet.c $(LWIPDIR)/netif/etharp.c \
|
||||
$(LWIPDIR)/netif/slipif.c
|
||||
|
||||
# SIXLOWPAN: 6LoWPAN
|
||||
SIXLOWPAN=$(LWIPDIR)/netif/lowpan6.c \
|
||||
|
||||
# PPPFILES: PPP
|
||||
PPPFILES=$(LWIPDIR)/netif/ppp/auth.c \
|
||||
$(LWIPDIR)/netif/ppp/ccp.c \
|
||||
$(LWIPDIR)/netif/ppp/chap-md5.c \
|
||||
$(LWIPDIR)/netif/ppp/chap_ms.c \
|
||||
$(LWIPDIR)/netif/ppp/chap-new.c \
|
||||
$(LWIPDIR)/netif/ppp/demand.c \
|
||||
$(LWIPDIR)/netif/ppp/eap.c \
|
||||
$(LWIPDIR)/netif/ppp/ecp.c \
|
||||
$(LWIPDIR)/netif/ppp/eui64.c \
|
||||
$(LWIPDIR)/netif/ppp/fsm.c \
|
||||
$(LWIPDIR)/netif/ppp/ipcp.c \
|
||||
$(LWIPDIR)/netif/ppp/ipv6cp.c \
|
||||
$(LWIPDIR)/netif/ppp/lcp.c \
|
||||
$(LWIPDIR)/netif/ppp/magic.c \
|
||||
$(LWIPDIR)/netif/ppp/mppe.c \
|
||||
$(LWIPDIR)/netif/ppp/multilink.c \
|
||||
$(LWIPDIR)/netif/ppp/ppp.c \
|
||||
$(LWIPDIR)/netif/ppp/pppapi.c \
|
||||
$(LWIPDIR)/netif/ppp/pppcrypt.c \
|
||||
$(LWIPDIR)/netif/ppp/pppoe.c \
|
||||
$(LWIPDIR)/netif/ppp/pppol2tp.c \
|
||||
$(LWIPDIR)/netif/ppp/pppos.c \
|
||||
$(LWIPDIR)/netif/ppp/upap.c \
|
||||
$(LWIPDIR)/netif/ppp/utils.c \
|
||||
$(LWIPDIR)/netif/ppp/vj.c \
|
||||
$(LWIPDIR)/netif/ppp/polarssl/arc4.c \
|
||||
$(LWIPDIR)/netif/ppp/polarssl/des.c \
|
||||
$(LWIPDIR)/netif/ppp/polarssl/md4.c \
|
||||
$(LWIPDIR)/netif/ppp/polarssl/md5.c \
|
||||
$(LWIPDIR)/netif/ppp/polarssl/sha1.c
|
||||
|
||||
# LWIPNOAPPSFILES: All LWIP files without apps
|
||||
LWIPNOAPPSFILES=$(COREFILES) \
|
||||
$(CORE4FILES) \
|
||||
$(CORE6FILES) \
|
||||
$(APIFILES) \
|
||||
$(NETIFFILES) \
|
||||
$(PPPFILES) \
|
||||
$(SIXLOWPAN)
|
||||
|
||||
# SNMPFILES: SNMPv2c agent
|
||||
SNMPFILES=$(LWIPDIR)/apps/snmp/snmp_asn1.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_core.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_mib2.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_mib2_icmp.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_mib2_interfaces.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_mib2_ip.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_mib2_snmp.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_mib2_system.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_mib2_tcp.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_mib2_udp.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_msg.c \
|
||||
$(LWIPDIR)/apps/snmp/snmpv3.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_netconn.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_pbuf_stream.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_raw.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_scalar.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_table.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_threadsync.c \
|
||||
$(LWIPDIR)/apps/snmp/snmp_traps.c \
|
||||
$(LWIPDIR)/apps/snmp/snmpv3_mbedtls.c \
|
||||
$(LWIPDIR)/apps/snmp/snmpv3_dummy.c
|
||||
|
||||
# HTTPDFILES: HTTP server
|
||||
HTTPDFILES=$(LWIPDIR)/apps/httpd/fs.c \
|
||||
$(LWIPDIR)/apps/httpd/httpd.c
|
||||
|
||||
# LWIPERFFILES: IPERF server
|
||||
LWIPERFFILES=$(LWIPDIR)/apps/lwiperf/lwiperf.c
|
||||
|
||||
# SNTPFILES: SNTP client
|
||||
SNTPFILES=$(LWIPDIR)/apps/sntp/sntp.c
|
||||
|
||||
# NETBIOSNSFILES: NetBIOS name server
|
||||
NETBIOSNSFILES=$(LWIPDIR)/apps/netbiosns/netbiosns.c
|
||||
|
||||
# LWIPAPPFILES: All LWIP APPs
|
||||
LWIPAPPFILES=$(SNMPFILES) \
|
||||
$(HTTPDFILES) \
|
||||
$(LWIPERFFILES) \
|
||||
$(SNTPFILES) \
|
||||
$(NETBIOSNSFILES)
|
||||
1490
src/api/api_lib.c
1490
src/api/api_lib.c
File diff suppressed because it is too large
Load Diff
2319
src/api/api_msg.c
2319
src/api/api_msg.c
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,8 @@
|
||||
/**
|
||||
* @file
|
||||
* Error Management module
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
@@ -17,21 +11,21 @@
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
@@ -40,36 +34,26 @@
|
||||
|
||||
#ifdef LWIP_DEBUG
|
||||
|
||||
static const char *err_strerr[] = {
|
||||
"Ok.", /* ERR_OK 0 */
|
||||
"Out of memory error.", /* ERR_MEM -1 */
|
||||
"Buffer error.", /* ERR_BUF -2 */
|
||||
"Timeout.", /* ERR_TIMEOUT -3 */
|
||||
"Routing problem.", /* ERR_RTE -4 */
|
||||
"Operation in progress.", /* ERR_INPROGRESS -5 */
|
||||
"Illegal value.", /* ERR_VAL -6 */
|
||||
"Operation would block.", /* ERR_WOULDBLOCK -7 */
|
||||
"Address in use.", /* ERR_USE -8 */
|
||||
"Already connecting.", /* ERR_ALREADY -9 */
|
||||
"Already connected.", /* ERR_ISCONN -10 */
|
||||
"Not connected.", /* ERR_CONN -11 */
|
||||
"Low-level netif error.", /* ERR_IF -12 */
|
||||
"Connection aborted.", /* ERR_ABRT -13 */
|
||||
"Connection reset.", /* ERR_RST -14 */
|
||||
"Connection closed.", /* ERR_CLSD -15 */
|
||||
"Illegal argument." /* ERR_ARG -16 */
|
||||
static char *err_strerr[] = {"Ok.",
|
||||
"Out of memory error.",
|
||||
"Buffer error.",
|
||||
"Connection aborted.",
|
||||
"Connection reset.",
|
||||
"Connection closed.",
|
||||
"Not connected.",
|
||||
"Illegal value.",
|
||||
"Illegal argument.",
|
||||
"Routing problem.",
|
||||
"Address in use."
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert an lwip internal error to a string representation.
|
||||
*
|
||||
* @param err an lwip internal err_t
|
||||
* @return a string representation for err
|
||||
*/
|
||||
const char *
|
||||
|
||||
char *
|
||||
lwip_strerr(err_t err)
|
||||
{
|
||||
return err_strerr[-err];
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif /* LWIP_DEBUG */
|
||||
|
||||
245
src/api/netbuf.c
245
src/api/netbuf.c
@@ -1,245 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
* Network buffer management
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#if LWIP_NETCONN /* don't build if not configured for use in lwipopts.h */
|
||||
|
||||
#include "lwip/netbuf.h"
|
||||
#include "lwip/memp.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/**
|
||||
* Create (allocate) and initialize a new netbuf.
|
||||
* The netbuf doesn't yet contain a packet buffer!
|
||||
*
|
||||
* @return a pointer to a new netbuf
|
||||
* NULL on lack of memory
|
||||
*/
|
||||
struct
|
||||
netbuf *netbuf_new(void)
|
||||
{
|
||||
struct netbuf *buf;
|
||||
|
||||
buf = (struct netbuf *)memp_malloc(MEMP_NETBUF);
|
||||
if (buf != NULL) {
|
||||
buf->p = NULL;
|
||||
buf->ptr = NULL;
|
||||
ip_addr_set_zero(&buf->addr);
|
||||
buf->port = 0;
|
||||
#if LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY
|
||||
#if LWIP_CHECKSUM_ON_COPY
|
||||
buf->flags = 0;
|
||||
#endif /* LWIP_CHECKSUM_ON_COPY */
|
||||
buf->toport_chksum = 0;
|
||||
#if LWIP_NETBUF_RECVINFO
|
||||
ip_addr_set_zero(&buf->toaddr);
|
||||
#endif /* LWIP_NETBUF_RECVINFO */
|
||||
#endif /* LWIP_NETBUF_RECVINFO || LWIP_CHECKSUM_ON_COPY */
|
||||
return buf;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deallocate a netbuf allocated by netbuf_new().
|
||||
*
|
||||
* @param buf pointer to a netbuf allocated by netbuf_new()
|
||||
*/
|
||||
void
|
||||
netbuf_delete(struct netbuf *buf)
|
||||
{
|
||||
if (buf != NULL) {
|
||||
if (buf->p != NULL) {
|
||||
pbuf_free(buf->p);
|
||||
buf->p = buf->ptr = NULL;
|
||||
}
|
||||
memp_free(MEMP_NETBUF, buf);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate memory for a packet buffer for a given netbuf.
|
||||
*
|
||||
* @param buf the netbuf for which to allocate a packet buffer
|
||||
* @param size the size of the packet buffer to allocate
|
||||
* @return pointer to the allocated memory
|
||||
* NULL if no memory could be allocated
|
||||
*/
|
||||
void *
|
||||
netbuf_alloc(struct netbuf *buf, u16_t size)
|
||||
{
|
||||
LWIP_ERROR("netbuf_alloc: invalid buf", (buf != NULL), return NULL;);
|
||||
|
||||
/* Deallocate any previously allocated memory. */
|
||||
if (buf->p != NULL) {
|
||||
pbuf_free(buf->p);
|
||||
}
|
||||
buf->p = pbuf_alloc(PBUF_TRANSPORT, size, PBUF_RAM);
|
||||
if (buf->p == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
LWIP_ASSERT("check that first pbuf can hold size",
|
||||
(buf->p->len >= size));
|
||||
buf->ptr = buf->p;
|
||||
return buf->p->payload;
|
||||
}
|
||||
|
||||
/**
|
||||
* Free the packet buffer included in a netbuf
|
||||
*
|
||||
* @param buf pointer to the netbuf which contains the packet buffer to free
|
||||
*/
|
||||
void
|
||||
netbuf_free(struct netbuf *buf)
|
||||
{
|
||||
LWIP_ERROR("netbuf_free: invalid buf", (buf != NULL), return;);
|
||||
if (buf->p != NULL) {
|
||||
pbuf_free(buf->p);
|
||||
}
|
||||
buf->p = buf->ptr = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Let a netbuf reference existing (non-volatile) data.
|
||||
*
|
||||
* @param buf netbuf which should reference the data
|
||||
* @param dataptr pointer to the data to reference
|
||||
* @param size size of the data
|
||||
* @return ERR_OK if data is referenced
|
||||
* ERR_MEM if data couldn't be referenced due to lack of memory
|
||||
*/
|
||||
err_t
|
||||
netbuf_ref(struct netbuf *buf, const void *dataptr, u16_t size)
|
||||
{
|
||||
LWIP_ERROR("netbuf_ref: invalid buf", (buf != NULL), return ERR_ARG;);
|
||||
if (buf->p != NULL) {
|
||||
pbuf_free(buf->p);
|
||||
}
|
||||
buf->p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_REF);
|
||||
if (buf->p == NULL) {
|
||||
buf->ptr = NULL;
|
||||
return ERR_MEM;
|
||||
}
|
||||
((struct pbuf_rom*)buf->p)->payload = dataptr;
|
||||
buf->p->len = buf->p->tot_len = size;
|
||||
buf->ptr = buf->p;
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Chain one netbuf to another (@see pbuf_chain)
|
||||
*
|
||||
* @param head the first netbuf
|
||||
* @param tail netbuf to chain after head, freed by this function, may not be reference after returning
|
||||
*/
|
||||
void
|
||||
netbuf_chain(struct netbuf *head, struct netbuf *tail)
|
||||
{
|
||||
LWIP_ERROR("netbuf_ref: invalid head", (head != NULL), return;);
|
||||
LWIP_ERROR("netbuf_chain: invalid tail", (tail != NULL), return;);
|
||||
pbuf_cat(head->p, tail->p);
|
||||
head->ptr = head->p;
|
||||
memp_free(MEMP_NETBUF, tail);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data pointer and length of the data inside a netbuf.
|
||||
*
|
||||
* @param buf netbuf to get the data from
|
||||
* @param dataptr pointer to a void pointer where to store the data pointer
|
||||
* @param len pointer to an u16_t where the length of the data is stored
|
||||
* @return ERR_OK if the information was retrieved,
|
||||
* ERR_BUF on error.
|
||||
*/
|
||||
err_t
|
||||
netbuf_data(struct netbuf *buf, void **dataptr, u16_t *len)
|
||||
{
|
||||
LWIP_ERROR("netbuf_data: invalid buf", (buf != NULL), return ERR_ARG;);
|
||||
LWIP_ERROR("netbuf_data: invalid dataptr", (dataptr != NULL), return ERR_ARG;);
|
||||
LWIP_ERROR("netbuf_data: invalid len", (len != NULL), return ERR_ARG;);
|
||||
|
||||
if (buf->ptr == NULL) {
|
||||
return ERR_BUF;
|
||||
}
|
||||
*dataptr = buf->ptr->payload;
|
||||
*len = buf->ptr->len;
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the current data pointer of a packet buffer contained in a netbuf
|
||||
* to the next part.
|
||||
* The packet buffer itself is not modified.
|
||||
*
|
||||
* @param buf the netbuf to modify
|
||||
* @return -1 if there is no next part
|
||||
* 1 if moved to the next part but now there is no next part
|
||||
* 0 if moved to the next part and there are still more parts
|
||||
*/
|
||||
s8_t
|
||||
netbuf_next(struct netbuf *buf)
|
||||
{
|
||||
LWIP_ERROR("netbuf_free: invalid buf", (buf != NULL), return -1;);
|
||||
if (buf->ptr->next == NULL) {
|
||||
return -1;
|
||||
}
|
||||
buf->ptr = buf->ptr->next;
|
||||
if (buf->ptr->next == NULL) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move the current data pointer of a packet buffer contained in a netbuf
|
||||
* to the beginning of the packet.
|
||||
* The packet buffer itself is not modified.
|
||||
*
|
||||
* @param buf the netbuf to modify
|
||||
*/
|
||||
void
|
||||
netbuf_first(struct netbuf *buf)
|
||||
{
|
||||
LWIP_ERROR("netbuf_free: invalid buf", (buf != NULL), return;);
|
||||
buf->ptr = buf->p;
|
||||
}
|
||||
|
||||
#endif /* LWIP_NETCONN */
|
||||
410
src/api/netdb.c
410
src/api/netdb.c
@@ -1,410 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
* API functions for name resolving
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Simon Goldschmidt
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/netdb.h"
|
||||
|
||||
#if LWIP_DNS && LWIP_SOCKET
|
||||
|
||||
#include "lwip/err.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/memp.h"
|
||||
#include "lwip/ip_addr.h"
|
||||
#include "lwip/api.h"
|
||||
#include "lwip/dns.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/** helper struct for gethostbyname_r to access the char* buffer */
|
||||
struct gethostbyname_r_helper {
|
||||
ip_addr_t *addr_list[2];
|
||||
ip_addr_t addr;
|
||||
char *aliases;
|
||||
};
|
||||
|
||||
/** h_errno is exported in netdb.h for access by applications. */
|
||||
#if LWIP_DNS_API_DECLARE_H_ERRNO
|
||||
int h_errno;
|
||||
#endif /* LWIP_DNS_API_DECLARE_H_ERRNO */
|
||||
|
||||
/** define "hostent" variables storage: 0 if we use a static (but unprotected)
|
||||
* set of variables for lwip_gethostbyname, 1 if we use a local storage */
|
||||
#ifndef LWIP_DNS_API_HOSTENT_STORAGE
|
||||
#define LWIP_DNS_API_HOSTENT_STORAGE 0
|
||||
#endif
|
||||
|
||||
/** define "hostent" variables storage */
|
||||
#if LWIP_DNS_API_HOSTENT_STORAGE
|
||||
#define HOSTENT_STORAGE
|
||||
#else
|
||||
#define HOSTENT_STORAGE static
|
||||
#endif /* LWIP_DNS_API_STATIC_HOSTENT */
|
||||
|
||||
/**
|
||||
* Returns an entry containing addresses of address family AF_INET
|
||||
* for the host with name name.
|
||||
* Due to dns_gethostbyname limitations, only one address is returned.
|
||||
*
|
||||
* @param name the hostname to resolve
|
||||
* @return an entry containing addresses of address family AF_INET
|
||||
* for the host with name name
|
||||
*/
|
||||
struct hostent*
|
||||
lwip_gethostbyname(const char *name)
|
||||
{
|
||||
err_t err;
|
||||
ip_addr_t addr;
|
||||
|
||||
/* buffer variables for lwip_gethostbyname() */
|
||||
HOSTENT_STORAGE struct hostent s_hostent;
|
||||
HOSTENT_STORAGE char *s_aliases;
|
||||
HOSTENT_STORAGE ip_addr_t s_hostent_addr;
|
||||
HOSTENT_STORAGE ip_addr_t *s_phostent_addr[2];
|
||||
HOSTENT_STORAGE char s_hostname[DNS_MAX_NAME_LENGTH + 1];
|
||||
|
||||
/* query host IP address */
|
||||
err = netconn_gethostbyname(name, &addr);
|
||||
if (err != ERR_OK) {
|
||||
LWIP_DEBUGF(DNS_DEBUG, ("lwip_gethostbyname(%s) failed, err=%d\n", name, err));
|
||||
h_errno = HOST_NOT_FOUND;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* fill hostent */
|
||||
s_hostent_addr = addr;
|
||||
s_phostent_addr[0] = &s_hostent_addr;
|
||||
s_phostent_addr[1] = NULL;
|
||||
strncpy(s_hostname, name, DNS_MAX_NAME_LENGTH);
|
||||
s_hostname[DNS_MAX_NAME_LENGTH] = 0;
|
||||
s_hostent.h_name = s_hostname;
|
||||
s_aliases = NULL;
|
||||
s_hostent.h_aliases = &s_aliases;
|
||||
s_hostent.h_addrtype = AF_INET;
|
||||
s_hostent.h_length = sizeof(ip_addr_t);
|
||||
s_hostent.h_addr_list = (char**)&s_phostent_addr;
|
||||
|
||||
#if DNS_DEBUG
|
||||
/* dump hostent */
|
||||
LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_name == %s\n", s_hostent.h_name));
|
||||
LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_aliases == %p\n", (void*)s_hostent.h_aliases));
|
||||
/* h_aliases are always empty */
|
||||
LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_addrtype == %d\n", s_hostent.h_addrtype));
|
||||
LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_length == %d\n", s_hostent.h_length));
|
||||
LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_addr_list == %p\n", (void*)s_hostent.h_addr_list));
|
||||
if (s_hostent.h_addr_list != NULL) {
|
||||
u8_t idx;
|
||||
for (idx=0; s_hostent.h_addr_list[idx]; idx++) {
|
||||
LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_addr_list[%i] == %p\n", idx, s_hostent.h_addr_list[idx]));
|
||||
LWIP_DEBUGF(DNS_DEBUG, ("hostent.h_addr_list[%i]-> == %s\n", idx, ipaddr_ntoa((ip_addr_t*)s_hostent.h_addr_list[idx])));
|
||||
}
|
||||
}
|
||||
#endif /* DNS_DEBUG */
|
||||
|
||||
#if LWIP_DNS_API_HOSTENT_STORAGE
|
||||
/* this function should return the "per-thread" hostent after copy from s_hostent */
|
||||
return sys_thread_hostent(&s_hostent);
|
||||
#else
|
||||
return &s_hostent;
|
||||
#endif /* LWIP_DNS_API_HOSTENT_STORAGE */
|
||||
}
|
||||
|
||||
/**
|
||||
* Thread-safe variant of lwip_gethostbyname: instead of using a static
|
||||
* buffer, this function takes buffer and errno pointers as arguments
|
||||
* and uses these for the result.
|
||||
*
|
||||
* @param name the hostname to resolve
|
||||
* @param ret pre-allocated struct where to store the result
|
||||
* @param buf pre-allocated buffer where to store additional data
|
||||
* @param buflen the size of buf
|
||||
* @param result pointer to a hostent pointer that is set to ret on success
|
||||
* and set to zero on error
|
||||
* @param h_errnop pointer to an int where to store errors (instead of modifying
|
||||
* the global h_errno)
|
||||
* @return 0 on success, non-zero on error, additional error information
|
||||
* is stored in *h_errnop instead of h_errno to be thread-safe
|
||||
*/
|
||||
int
|
||||
lwip_gethostbyname_r(const char *name, struct hostent *ret, char *buf,
|
||||
size_t buflen, struct hostent **result, int *h_errnop)
|
||||
{
|
||||
err_t err;
|
||||
struct gethostbyname_r_helper *h;
|
||||
char *hostname;
|
||||
size_t namelen;
|
||||
int lh_errno;
|
||||
|
||||
if (h_errnop == NULL) {
|
||||
/* ensure h_errnop is never NULL */
|
||||
h_errnop = &lh_errno;
|
||||
}
|
||||
|
||||
if (result == NULL) {
|
||||
/* not all arguments given */
|
||||
*h_errnop = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
/* first thing to do: set *result to nothing */
|
||||
*result = NULL;
|
||||
if ((name == NULL) || (ret == NULL) || (buf == NULL)) {
|
||||
/* not all arguments given */
|
||||
*h_errnop = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
namelen = strlen(name);
|
||||
if (buflen < (sizeof(struct gethostbyname_r_helper) + namelen + 1 + (MEM_ALIGNMENT - 1))) {
|
||||
/* buf can't hold the data needed + a copy of name */
|
||||
*h_errnop = ERANGE;
|
||||
return -1;
|
||||
}
|
||||
|
||||
h = (struct gethostbyname_r_helper*)LWIP_MEM_ALIGN(buf);
|
||||
hostname = ((char*)h) + sizeof(struct gethostbyname_r_helper);
|
||||
|
||||
/* query host IP address */
|
||||
err = netconn_gethostbyname(name, &h->addr);
|
||||
if (err != ERR_OK) {
|
||||
LWIP_DEBUGF(DNS_DEBUG, ("lwip_gethostbyname(%s) failed, err=%d\n", name, err));
|
||||
*h_errnop = HOST_NOT_FOUND;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* copy the hostname into buf */
|
||||
MEMCPY(hostname, name, namelen);
|
||||
hostname[namelen] = 0;
|
||||
|
||||
/* fill hostent */
|
||||
h->addr_list[0] = &h->addr;
|
||||
h->addr_list[1] = NULL;
|
||||
h->aliases = NULL;
|
||||
ret->h_name = hostname;
|
||||
ret->h_aliases = &h->aliases;
|
||||
ret->h_addrtype = AF_INET;
|
||||
ret->h_length = sizeof(ip_addr_t);
|
||||
ret->h_addr_list = (char**)&h->addr_list;
|
||||
|
||||
/* set result != NULL */
|
||||
*result = ret;
|
||||
|
||||
/* return success */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Frees one or more addrinfo structures returned by getaddrinfo(), along with
|
||||
* any additional storage associated with those structures. If the ai_next field
|
||||
* of the structure is not null, the entire list of structures is freed.
|
||||
*
|
||||
* @param ai struct addrinfo to free
|
||||
*/
|
||||
void
|
||||
lwip_freeaddrinfo(struct addrinfo *ai)
|
||||
{
|
||||
struct addrinfo *next;
|
||||
|
||||
while (ai != NULL) {
|
||||
next = ai->ai_next;
|
||||
memp_free(MEMP_NETDB, ai);
|
||||
ai = next;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates the name of a service location (for example, a host name) and/or
|
||||
* a service name and returns a set of socket addresses and associated
|
||||
* information to be used in creating a socket with which to address the
|
||||
* specified service.
|
||||
* Memory for the result is allocated internally and must be freed by calling
|
||||
* lwip_freeaddrinfo()!
|
||||
*
|
||||
* Due to a limitation in dns_gethostbyname, only the first address of a
|
||||
* host is returned.
|
||||
* Also, service names are not supported (only port numbers)!
|
||||
*
|
||||
* @param nodename descriptive name or address string of the host
|
||||
* (may be NULL -> local address)
|
||||
* @param servname port number as string of NULL
|
||||
* @param hints structure containing input values that set socktype and protocol
|
||||
* @param res pointer to a pointer where to store the result (set to NULL on failure)
|
||||
* @return 0 on success, non-zero on failure
|
||||
*
|
||||
* @todo: implement AI_V4MAPPED, AI_ADDRCONFIG
|
||||
*/
|
||||
int
|
||||
lwip_getaddrinfo(const char *nodename, const char *servname,
|
||||
const struct addrinfo *hints, struct addrinfo **res)
|
||||
{
|
||||
err_t err;
|
||||
ip_addr_t addr;
|
||||
struct addrinfo *ai;
|
||||
struct sockaddr_storage *sa = NULL;
|
||||
int port_nr = 0;
|
||||
size_t total_size;
|
||||
size_t namelen = 0;
|
||||
int ai_family;
|
||||
|
||||
if (res == NULL) {
|
||||
return EAI_FAIL;
|
||||
}
|
||||
*res = NULL;
|
||||
if ((nodename == NULL) && (servname == NULL)) {
|
||||
return EAI_NONAME;
|
||||
}
|
||||
|
||||
if (hints != NULL) {
|
||||
ai_family = hints->ai_family;
|
||||
if ((ai_family != AF_UNSPEC)
|
||||
#if LWIP_IPV4
|
||||
&& (ai_family != AF_INET)
|
||||
#endif /* LWIP_IPV4 */
|
||||
#if LWIP_IPV6
|
||||
&& (ai_family != AF_INET6)
|
||||
#endif /* LWIP_IPV6 */
|
||||
) {
|
||||
return EAI_FAMILY;
|
||||
}
|
||||
} else {
|
||||
ai_family = AF_UNSPEC;
|
||||
}
|
||||
|
||||
if (servname != NULL) {
|
||||
/* service name specified: convert to port number
|
||||
* @todo?: currently, only ASCII integers (port numbers) are supported (AI_NUMERICSERV)! */
|
||||
port_nr = atoi(servname);
|
||||
if ((port_nr <= 0) || (port_nr > 0xffff)) {
|
||||
return EAI_SERVICE;
|
||||
}
|
||||
}
|
||||
|
||||
if (nodename != NULL) {
|
||||
/* service location specified, try to resolve */
|
||||
if ((hints != NULL) && (hints->ai_flags & AI_NUMERICHOST)) {
|
||||
/* no DNS lookup, just parse for an address string */
|
||||
if (!ipaddr_aton(nodename, &addr)) {
|
||||
return EAI_NONAME;
|
||||
}
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
if ((IP_IS_V6_VAL(addr) && ai_family == AF_INET) ||
|
||||
(IP_IS_V4_VAL(addr) && ai_family == AF_INET6)) {
|
||||
return EAI_NONAME;
|
||||
}
|
||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
} else {
|
||||
#if LWIP_IPV4 && LWIP_IPV6
|
||||
/* AF_UNSPEC: prefer IPv4 */
|
||||
u8_t type = NETCONN_DNS_IPV4_IPV6;
|
||||
if (ai_family == AF_INET) {
|
||||
type = NETCONN_DNS_IPV4;
|
||||
} else if (ai_family == AF_INET6) {
|
||||
type = NETCONN_DNS_IPV6;
|
||||
}
|
||||
#endif /* LWIP_IPV4 && LWIP_IPV6 */
|
||||
err = netconn_gethostbyname_addrtype(nodename, &addr, type);
|
||||
if (err != ERR_OK) {
|
||||
return EAI_FAIL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* service location specified, use loopback address */
|
||||
if ((hints != NULL) && (hints->ai_flags & AI_PASSIVE)) {
|
||||
ip_addr_set_any(ai_family == AF_INET6, &addr);
|
||||
} else {
|
||||
ip_addr_set_loopback(ai_family == AF_INET6, &addr);
|
||||
}
|
||||
}
|
||||
|
||||
total_size = sizeof(struct addrinfo) + sizeof(struct sockaddr_storage);
|
||||
if (nodename != NULL) {
|
||||
namelen = strlen(nodename);
|
||||
if (namelen > DNS_MAX_NAME_LENGTH) {
|
||||
/* invalid name length */
|
||||
return EAI_FAIL;
|
||||
}
|
||||
LWIP_ASSERT("namelen is too long", total_size + namelen + 1 > total_size);
|
||||
total_size += namelen + 1;
|
||||
}
|
||||
/* If this fails, please report to lwip-devel! :-) */
|
||||
LWIP_ASSERT("total_size <= NETDB_ELEM_SIZE: please report this!",
|
||||
total_size <= NETDB_ELEM_SIZE);
|
||||
ai = (struct addrinfo *)memp_malloc(MEMP_NETDB);
|
||||
if (ai == NULL) {
|
||||
return EAI_MEMORY;
|
||||
}
|
||||
memset(ai, 0, total_size);
|
||||
sa = (struct sockaddr_storage *)(void*)((u8_t*)ai + sizeof(struct addrinfo));
|
||||
if (IP_IS_V6_VAL(addr)) {
|
||||
#if LWIP_IPV6
|
||||
struct sockaddr_in6 *sa6 = (struct sockaddr_in6*)sa;
|
||||
/* set up sockaddr */
|
||||
inet6_addr_from_ip6addr(&sa6->sin6_addr, ip_2_ip6(&addr));
|
||||
sa6->sin6_family = AF_INET6;
|
||||
sa6->sin6_len = sizeof(struct sockaddr_in6);
|
||||
sa6->sin6_port = htons((u16_t)port_nr);
|
||||
ai->ai_family = AF_INET6;
|
||||
#endif /* LWIP_IPV6 */
|
||||
} else {
|
||||
#if LWIP_IPV4
|
||||
struct sockaddr_in *sa4 = (struct sockaddr_in*)sa;
|
||||
/* set up sockaddr */
|
||||
inet_addr_from_ipaddr(&sa4->sin_addr, ip_2_ip4(&addr));
|
||||
sa4->sin_family = AF_INET;
|
||||
sa4->sin_len = sizeof(struct sockaddr_in);
|
||||
sa4->sin_port = htons((u16_t)port_nr);
|
||||
ai->ai_family = AF_INET;
|
||||
#endif /* LWIP_IPV4 */
|
||||
}
|
||||
|
||||
/* set up addrinfo */
|
||||
if (hints != NULL) {
|
||||
/* copy socktype & protocol from hints if specified */
|
||||
ai->ai_socktype = hints->ai_socktype;
|
||||
ai->ai_protocol = hints->ai_protocol;
|
||||
}
|
||||
if (nodename != NULL) {
|
||||
/* copy nodename to canonname if specified */
|
||||
ai->ai_canonname = ((char*)ai + sizeof(struct addrinfo) + sizeof(struct sockaddr_storage));
|
||||
MEMCPY(ai->ai_canonname, nodename, namelen);
|
||||
ai->ai_canonname[namelen] = 0;
|
||||
}
|
||||
ai->ai_addrlen = sizeof(struct sockaddr_storage);
|
||||
ai->ai_addr = (struct sockaddr*)sa;
|
||||
|
||||
*res = ai;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* LWIP_DNS && LWIP_SOCKET */
|
||||
@@ -1,206 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
* Network Interface Sequential API module
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#if LWIP_NETIF_API /* don't build if not configured for use in lwipopts.h */
|
||||
|
||||
#include "lwip/netifapi.h"
|
||||
#include "lwip/memp.h"
|
||||
#include "lwip/priv/tcpip_priv.h"
|
||||
|
||||
#define NETIFAPI_VAR_REF(name) API_VAR_REF(name)
|
||||
#define NETIFAPI_VAR_DECLARE(name) API_VAR_DECLARE(struct netifapi_msg, name)
|
||||
#define NETIFAPI_VAR_ALLOC(name) API_VAR_ALLOC(struct netifapi_msg, MEMP_NETIFAPI_MSG, name, ERR_MEM)
|
||||
#define NETIFAPI_VAR_FREE(name) API_VAR_FREE(MEMP_NETIFAPI_MSG, name)
|
||||
|
||||
/**
|
||||
* Call netif_add() inside the tcpip_thread context.
|
||||
*/
|
||||
static err_t
|
||||
netifapi_do_netif_add(struct tcpip_api_call_data *m)
|
||||
{
|
||||
struct netifapi_msg *msg = (struct netifapi_msg*)m;
|
||||
|
||||
if (!netif_add( msg->netif,
|
||||
#if LWIP_IPV4
|
||||
API_EXPR_REF(msg->msg.add.ipaddr),
|
||||
API_EXPR_REF(msg->msg.add.netmask),
|
||||
API_EXPR_REF(msg->msg.add.gw),
|
||||
#endif /* LWIP_IPV4 */
|
||||
msg->msg.add.state,
|
||||
msg->msg.add.init,
|
||||
msg->msg.add.input)) {
|
||||
return ERR_IF;
|
||||
} else {
|
||||
return ERR_OK;
|
||||
}
|
||||
}
|
||||
|
||||
#if LWIP_IPV4
|
||||
/**
|
||||
* Call netif_set_addr() inside the tcpip_thread context.
|
||||
*/
|
||||
static err_t
|
||||
netifapi_do_netif_set_addr(struct tcpip_api_call_data *m)
|
||||
{
|
||||
struct netifapi_msg *msg = (struct netifapi_msg*)m;
|
||||
|
||||
netif_set_addr( msg->netif,
|
||||
API_EXPR_REF(msg->msg.add.ipaddr),
|
||||
API_EXPR_REF(msg->msg.add.netmask),
|
||||
API_EXPR_REF(msg->msg.add.gw));
|
||||
return ERR_OK;
|
||||
}
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
/**
|
||||
* Call the "errtfunc" (or the "voidfunc" if "errtfunc" is NULL) inside the
|
||||
* tcpip_thread context.
|
||||
*/
|
||||
static err_t
|
||||
netifapi_do_netif_common(struct tcpip_api_call_data *m)
|
||||
{
|
||||
struct netifapi_msg *msg = (struct netifapi_msg*)m;
|
||||
|
||||
if (msg->msg.common.errtfunc != NULL) {
|
||||
return msg->msg.common.errtfunc(msg->netif);
|
||||
} else {
|
||||
msg->msg.common.voidfunc(msg->netif);
|
||||
return ERR_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call netif_add() in a thread-safe way by running that function inside the
|
||||
* tcpip_thread context.
|
||||
*
|
||||
* @note for params @see netif_add()
|
||||
*/
|
||||
err_t
|
||||
netifapi_netif_add(struct netif *netif,
|
||||
#if LWIP_IPV4
|
||||
const ip4_addr_t *ipaddr, const ip4_addr_t *netmask, const ip4_addr_t *gw,
|
||||
#endif /* LWIP_IPV4 */
|
||||
void *state, netif_init_fn init, netif_input_fn input)
|
||||
{
|
||||
err_t err;
|
||||
NETIFAPI_VAR_DECLARE(msg);
|
||||
NETIFAPI_VAR_ALLOC(msg);
|
||||
|
||||
#if LWIP_IPV4
|
||||
if (ipaddr == NULL) {
|
||||
ipaddr = IP4_ADDR_ANY;
|
||||
}
|
||||
if (netmask == NULL) {
|
||||
netmask = IP4_ADDR_ANY;
|
||||
}
|
||||
if (gw == NULL) {
|
||||
gw = IP4_ADDR_ANY;
|
||||
}
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
NETIFAPI_VAR_REF(msg).netif = netif;
|
||||
#if LWIP_IPV4
|
||||
NETIFAPI_VAR_REF(msg).msg.add.ipaddr = NETIFAPI_VAR_REF(ipaddr);
|
||||
NETIFAPI_VAR_REF(msg).msg.add.netmask = NETIFAPI_VAR_REF(netmask);
|
||||
NETIFAPI_VAR_REF(msg).msg.add.gw = NETIFAPI_VAR_REF(gw);
|
||||
#endif /* LWIP_IPV4 */
|
||||
NETIFAPI_VAR_REF(msg).msg.add.state = state;
|
||||
NETIFAPI_VAR_REF(msg).msg.add.init = init;
|
||||
NETIFAPI_VAR_REF(msg).msg.add.input = input;
|
||||
err = tcpip_api_call(netifapi_do_netif_add, &API_VAR_REF(msg).call);
|
||||
NETIFAPI_VAR_FREE(msg);
|
||||
return err;
|
||||
}
|
||||
|
||||
#if LWIP_IPV4
|
||||
/**
|
||||
* Call netif_set_addr() in a thread-safe way by running that function inside the
|
||||
* tcpip_thread context.
|
||||
*
|
||||
* @note for params @see netif_set_addr()
|
||||
*/
|
||||
err_t
|
||||
netifapi_netif_set_addr(struct netif *netif,
|
||||
const ip4_addr_t *ipaddr,
|
||||
const ip4_addr_t *netmask,
|
||||
const ip4_addr_t *gw)
|
||||
{
|
||||
err_t err;
|
||||
NETIFAPI_VAR_DECLARE(msg);
|
||||
NETIFAPI_VAR_ALLOC(msg);
|
||||
|
||||
if (ipaddr == NULL) {
|
||||
ipaddr = IP4_ADDR_ANY;
|
||||
}
|
||||
if (netmask == NULL) {
|
||||
netmask = IP4_ADDR_ANY;
|
||||
}
|
||||
if (gw == NULL) {
|
||||
gw = IP4_ADDR_ANY;
|
||||
}
|
||||
|
||||
NETIFAPI_VAR_REF(msg).netif = netif;
|
||||
NETIFAPI_VAR_REF(msg).msg.add.ipaddr = NETIFAPI_VAR_REF(ipaddr);
|
||||
NETIFAPI_VAR_REF(msg).msg.add.netmask = NETIFAPI_VAR_REF(netmask);
|
||||
NETIFAPI_VAR_REF(msg).msg.add.gw = NETIFAPI_VAR_REF(gw);
|
||||
err = tcpip_api_call(netifapi_do_netif_set_addr, &API_VAR_REF(msg).call);
|
||||
NETIFAPI_VAR_FREE(msg);
|
||||
return err;
|
||||
}
|
||||
#endif /* LWIP_IPV4 */
|
||||
|
||||
/**
|
||||
* call the "errtfunc" (or the "voidfunc" if "errtfunc" is NULL) in a thread-safe
|
||||
* way by running that function inside the tcpip_thread context.
|
||||
*
|
||||
* @note use only for functions where there is only "netif" parameter.
|
||||
*/
|
||||
err_t
|
||||
netifapi_netif_common(struct netif *netif, netifapi_void_fn voidfunc,
|
||||
netifapi_errt_fn errtfunc)
|
||||
{
|
||||
err_t err;
|
||||
NETIFAPI_VAR_DECLARE(msg);
|
||||
NETIFAPI_VAR_ALLOC(msg);
|
||||
|
||||
NETIFAPI_VAR_REF(msg).netif = netif;
|
||||
NETIFAPI_VAR_REF(msg).msg.common.voidfunc = voidfunc;
|
||||
NETIFAPI_VAR_REF(msg).msg.common.errtfunc = errtfunc;
|
||||
err = tcpip_api_call(netifapi_do_netif_common, &API_VAR_REF(msg).call);
|
||||
NETIFAPI_VAR_FREE(msg);
|
||||
return err;
|
||||
}
|
||||
|
||||
#endif /* LWIP_NETIF_API */
|
||||
3146
src/api/sockets.c
3146
src/api/sockets.c
File diff suppressed because it is too large
Load Diff
520
src/api/tcpip.c
520
src/api/tcpip.c
@@ -1,14 +1,8 @@
|
||||
/**
|
||||
* @file
|
||||
* Sequential API Main thread module
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
@@ -17,493 +11,167 @@
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/opt.h"
|
||||
|
||||
#if !NO_SYS /* don't build if not configured for use in lwipopts.h */
|
||||
|
||||
#include "lwip/priv/tcpip_priv.h"
|
||||
#include "lwip/sys.h"
|
||||
|
||||
#include "lwip/memp.h"
|
||||
#include "lwip/mem.h"
|
||||
#include "lwip/init.h"
|
||||
#include "lwip/ip.h"
|
||||
#include "lwip/pbuf.h"
|
||||
#include "netif/etharp.h"
|
||||
|
||||
#define TCPIP_MSG_VAR_REF(name) API_VAR_REF(name)
|
||||
#define TCPIP_MSG_VAR_DECLARE(name) API_VAR_DECLARE(struct tcpip_msg, name)
|
||||
#define TCPIP_MSG_VAR_ALLOC(name) API_VAR_ALLOC(struct tcpip_msg, MEMP_TCPIP_MSG_API, name, ERR_MEM)
|
||||
#define TCPIP_MSG_VAR_FREE(name) API_VAR_FREE(MEMP_TCPIP_MSG_API, name)
|
||||
#include "lwip/ip.h"
|
||||
#include "lwip/udp.h"
|
||||
#include "lwip/tcp.h"
|
||||
|
||||
/* global variables */
|
||||
static tcpip_init_done_fn tcpip_init_done;
|
||||
#include "lwip/tcpip.h"
|
||||
|
||||
static void (* tcpip_init_done)(void *arg) = NULL;
|
||||
static void *tcpip_init_done_arg;
|
||||
static sys_mbox_t mbox;
|
||||
|
||||
#if LWIP_TCPIP_CORE_LOCKING
|
||||
/** The global semaphore to lock the stack. */
|
||||
sys_mutex_t lock_tcpip_core;
|
||||
#endif /* LWIP_TCPIP_CORE_LOCKING */
|
||||
#if LWIP_TCP
|
||||
static int tcpip_tcp_timer_active = 0;
|
||||
|
||||
|
||||
/**
|
||||
* The main lwIP thread. This thread has exclusive access to lwIP core functions
|
||||
* (unless access to them is not locked). Other threads communicate with this
|
||||
* thread using message boxes.
|
||||
*
|
||||
* It also starts all the timers to make sure they are running in the right
|
||||
* thread context.
|
||||
*
|
||||
* @param arg unused argument
|
||||
*/
|
||||
|
||||
static void
|
||||
tcpip_tcp_timer(void *arg)
|
||||
{
|
||||
(void)arg;
|
||||
|
||||
tcp_tmr();
|
||||
if (tcp_active_pcbs || tcp_tw_pcbs) {
|
||||
sys_timeout(TCP_TMR_INTERVAL, tcpip_tcp_timer, NULL);
|
||||
} else {
|
||||
tcpip_tcp_timer_active = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tcp_timer_needed(void)
|
||||
{
|
||||
if (!tcpip_tcp_timer_active && (tcp_active_pcbs || tcp_tw_pcbs)) {
|
||||
tcpip_tcp_timer_active = 1;
|
||||
sys_timeout(TCP_TMR_INTERVAL, tcpip_tcp_timer, NULL);
|
||||
}
|
||||
}
|
||||
#endif /* LWIP_TCP */
|
||||
|
||||
static void
|
||||
tcpip_thread(void *arg)
|
||||
{
|
||||
struct tcpip_msg *msg;
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
|
||||
(void)arg;
|
||||
|
||||
ip_init();
|
||||
#if LWIP_UDP
|
||||
udp_init();
|
||||
#endif
|
||||
#if LWIP_TCP
|
||||
tcp_init();
|
||||
#endif
|
||||
if (tcpip_init_done != NULL) {
|
||||
tcpip_init_done(tcpip_init_done_arg);
|
||||
}
|
||||
|
||||
LOCK_TCPIP_CORE();
|
||||
while (1) { /* MAIN Loop */
|
||||
UNLOCK_TCPIP_CORE();
|
||||
LWIP_TCPIP_THREAD_ALIVE();
|
||||
/* wait for a message, timeouts are processed while waiting */
|
||||
sys_timeouts_mbox_fetch(&mbox, (void **)&msg);
|
||||
LOCK_TCPIP_CORE();
|
||||
if (msg == NULL) {
|
||||
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: invalid message: NULL\n"));
|
||||
LWIP_ASSERT("tcpip_thread: invalid message", 0);
|
||||
continue;
|
||||
}
|
||||
sys_mbox_fetch(mbox, (void *)&msg);
|
||||
switch (msg->type) {
|
||||
#if !LWIP_TCPIP_CORE_LOCKING
|
||||
case TCPIP_MSG_API:
|
||||
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API message %p\n", (void *)msg));
|
||||
msg->msg.api_msg.function(msg->msg.api_msg.msg);
|
||||
api_msg_input(msg->msg.apimsg);
|
||||
break;
|
||||
case TCPIP_MSG_API_CALL:
|
||||
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API CALL message %p\n", (void *)msg));
|
||||
msg->msg.api_call.arg->err = msg->msg.api_call.function(msg->msg.api_call.arg);
|
||||
sys_sem_signal(msg->msg.api_call.sem);
|
||||
case TCPIP_MSG_INPUT:
|
||||
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: IP packet %p\n", (void *)msg));
|
||||
ip_input(msg->msg.inp.p, msg->msg.inp.netif);
|
||||
break;
|
||||
#endif /* !LWIP_TCPIP_CORE_LOCKING */
|
||||
|
||||
#if !LWIP_TCPIP_CORE_LOCKING_INPUT
|
||||
case TCPIP_MSG_INPKT:
|
||||
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: PACKET %p\n", (void *)msg));
|
||||
msg->msg.inp.input_fn(msg->msg.inp.p, msg->msg.inp.netif);
|
||||
memp_free(MEMP_TCPIP_MSG_INPKT, msg);
|
||||
break;
|
||||
#endif /* !LWIP_TCPIP_CORE_LOCKING_INPUT */
|
||||
|
||||
#if LWIP_TCPIP_TIMEOUT
|
||||
case TCPIP_MSG_TIMEOUT:
|
||||
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: TIMEOUT %p\n", (void *)msg));
|
||||
sys_timeout(msg->msg.tmo.msecs, msg->msg.tmo.h, msg->msg.tmo.arg);
|
||||
memp_free(MEMP_TCPIP_MSG_API, msg);
|
||||
break;
|
||||
case TCPIP_MSG_UNTIMEOUT:
|
||||
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: UNTIMEOUT %p\n", (void *)msg));
|
||||
sys_untimeout(msg->msg.tmo.h, msg->msg.tmo.arg);
|
||||
memp_free(MEMP_TCPIP_MSG_API, msg);
|
||||
break;
|
||||
#endif /* LWIP_TCPIP_TIMEOUT */
|
||||
|
||||
case TCPIP_MSG_CALLBACK:
|
||||
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK %p\n", (void *)msg));
|
||||
msg->msg.cb.function(msg->msg.cb.ctx);
|
||||
memp_free(MEMP_TCPIP_MSG_API, msg);
|
||||
msg->msg.cb.f(msg->msg.cb.ctx);
|
||||
break;
|
||||
|
||||
case TCPIP_MSG_CALLBACK_STATIC:
|
||||
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK_STATIC %p\n", (void *)msg));
|
||||
msg->msg.cb.function(msg->msg.cb.ctx);
|
||||
break;
|
||||
|
||||
default:
|
||||
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: invalid message: %d\n", msg->type));
|
||||
LWIP_ASSERT("tcpip_thread: invalid message", 0);
|
||||
break;
|
||||
}
|
||||
memp_free(MEMP_TCPIP_MSG, msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass a received packet to tcpip_thread for input processing
|
||||
*
|
||||
* @param p the received packet
|
||||
* @param inp the network interface on which the packet was received
|
||||
* @param input_fn input function to call
|
||||
*/
|
||||
err_t
|
||||
tcpip_inpkt(struct pbuf *p, struct netif *inp, netif_input_fn input_fn)
|
||||
{
|
||||
#if LWIP_TCPIP_CORE_LOCKING_INPUT
|
||||
err_t ret;
|
||||
LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_inpkt: PACKET %p/%p\n", (void *)p, (void *)inp));
|
||||
LOCK_TCPIP_CORE();
|
||||
ret = input_fn(p, inp);
|
||||
UNLOCK_TCPIP_CORE();
|
||||
return ret;
|
||||
#else /* LWIP_TCPIP_CORE_LOCKING_INPUT */
|
||||
struct tcpip_msg *msg;
|
||||
|
||||
LWIP_ASSERT("Invalid mbox", sys_mbox_valid_val(mbox));
|
||||
|
||||
msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_INPKT);
|
||||
if (msg == NULL) {
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
msg->type = TCPIP_MSG_INPKT;
|
||||
msg->msg.inp.p = p;
|
||||
msg->msg.inp.netif = inp;
|
||||
msg->msg.inp.input_fn = input_fn;
|
||||
if (sys_mbox_trypost(&mbox, msg) != ERR_OK) {
|
||||
memp_free(MEMP_TCPIP_MSG_INPKT, msg);
|
||||
return ERR_MEM;
|
||||
}
|
||||
return ERR_OK;
|
||||
#endif /* LWIP_TCPIP_CORE_LOCKING_INPUT */
|
||||
}
|
||||
|
||||
/**
|
||||
* Pass a received packet to tcpip_thread for input processing with
|
||||
* ethernet_input or ip_input
|
||||
*
|
||||
* @param p the received packet, p->payload pointing to the Ethernet header or
|
||||
* to an IP header (if inp doesn't have NETIF_FLAG_ETHARP or
|
||||
* NETIF_FLAG_ETHERNET flags)
|
||||
* @param inp the network interface on which the packet was received
|
||||
*/
|
||||
err_t
|
||||
tcpip_input(struct pbuf *p, struct netif *inp)
|
||||
{
|
||||
#if LWIP_ETHERNET
|
||||
if (inp->flags & (NETIF_FLAG_ETHARP | NETIF_FLAG_ETHERNET)) {
|
||||
return tcpip_inpkt(p, inp, ethernet_input);
|
||||
} else
|
||||
#endif /* LWIP_ETHERNET */
|
||||
return tcpip_inpkt(p, inp, ip_input);
|
||||
struct tcpip_msg *msg;
|
||||
|
||||
msg = memp_malloc(MEMP_TCPIP_MSG);
|
||||
if (msg == NULL) {
|
||||
pbuf_free(p);
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
msg->type = TCPIP_MSG_INPUT;
|
||||
msg->msg.inp.p = p;
|
||||
msg->msg.inp.netif = inp;
|
||||
sys_mbox_post(mbox, msg);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Call a specific function in the thread context of
|
||||
* tcpip_thread for easy access synchronization.
|
||||
* A function called in that way may access lwIP core code
|
||||
* without fearing concurrent access.
|
||||
*
|
||||
* @param f the function to call
|
||||
* @param ctx parameter passed to f
|
||||
* @param block 1 to block until the request is posted, 0 to non-blocking mode
|
||||
* @return ERR_OK if the function was called, another err_t if not
|
||||
*/
|
||||
err_t
|
||||
tcpip_callback_with_block(tcpip_callback_fn function, void *ctx, u8_t block)
|
||||
tcpip_callback(void (*f)(void *ctx), void *ctx)
|
||||
{
|
||||
struct tcpip_msg *msg;
|
||||
|
||||
LWIP_ASSERT("Invalid mbox", sys_mbox_valid_val(mbox));
|
||||
|
||||
msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API);
|
||||
|
||||
msg = memp_malloc(MEMP_TCPIP_MSG);
|
||||
if (msg == NULL) {
|
||||
return ERR_MEM;
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
|
||||
msg->type = TCPIP_MSG_CALLBACK;
|
||||
msg->msg.cb.function = function;
|
||||
msg->msg.cb.f = f;
|
||||
msg->msg.cb.ctx = ctx;
|
||||
if (block) {
|
||||
sys_mbox_post(&mbox, msg);
|
||||
} else {
|
||||
if (sys_mbox_trypost(&mbox, msg) != ERR_OK) {
|
||||
memp_free(MEMP_TCPIP_MSG_API, msg);
|
||||
return ERR_MEM;
|
||||
}
|
||||
}
|
||||
sys_mbox_post(mbox, msg);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
#if LWIP_TCPIP_TIMEOUT
|
||||
/**
|
||||
* call sys_timeout in tcpip_thread
|
||||
*
|
||||
* @param msec time in milliseconds for timeout
|
||||
* @param h function to be called on timeout
|
||||
* @param arg argument to pass to timeout function h
|
||||
* @return ERR_MEM on memory error, ERR_OK otherwise
|
||||
*/
|
||||
err_t
|
||||
tcpip_timeout(u32_t msecs, sys_timeout_handler h, void *arg)
|
||||
void
|
||||
tcpip_apimsg(struct api_msg *apimsg)
|
||||
{
|
||||
struct tcpip_msg *msg;
|
||||
|
||||
LWIP_ASSERT("Invalid mbox", sys_mbox_valid_val(mbox));
|
||||
|
||||
msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API);
|
||||
msg = memp_malloc(MEMP_TCPIP_MSG);
|
||||
if (msg == NULL) {
|
||||
return ERR_MEM;
|
||||
memp_free(MEMP_API_MSG, apimsg);
|
||||
return;
|
||||
}
|
||||
|
||||
msg->type = TCPIP_MSG_TIMEOUT;
|
||||
msg->msg.tmo.msecs = msecs;
|
||||
msg->msg.tmo.h = h;
|
||||
msg->msg.tmo.arg = arg;
|
||||
sys_mbox_post(&mbox, msg);
|
||||
return ERR_OK;
|
||||
msg->type = TCPIP_MSG_API;
|
||||
msg->msg.apimsg = apimsg;
|
||||
sys_mbox_post(mbox, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* call sys_untimeout in tcpip_thread
|
||||
*
|
||||
* @param msec time in milliseconds for timeout
|
||||
* @param h function to be called on timeout
|
||||
* @param arg argument to pass to timeout function h
|
||||
* @return ERR_MEM on memory error, ERR_OK otherwise
|
||||
*/
|
||||
err_t
|
||||
tcpip_untimeout(sys_timeout_handler h, void *arg)
|
||||
{
|
||||
struct tcpip_msg *msg;
|
||||
|
||||
LWIP_ASSERT("Invalid mbox", sys_mbox_valid_val(mbox));
|
||||
|
||||
msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API);
|
||||
if (msg == NULL) {
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
msg->type = TCPIP_MSG_UNTIMEOUT;
|
||||
msg->msg.tmo.h = h;
|
||||
msg->msg.tmo.arg = arg;
|
||||
sys_mbox_post(&mbox, msg);
|
||||
return ERR_OK;
|
||||
}
|
||||
#endif /* LWIP_TCPIP_TIMEOUT */
|
||||
|
||||
|
||||
/**
|
||||
* Sends a message to TCPIP thread to call a function. Caller thread blocks on
|
||||
* on a provided semaphore, which ist NOT automatically signalled by TCPIP thread,
|
||||
* this has to be done by the user.
|
||||
* It is recommended to use LWIP_TCPIP_CORE_LOCKING since this is the way
|
||||
* with least runtime overhead.
|
||||
*
|
||||
* @param fn function to be called from TCPIP thread
|
||||
* @param apimsg argument to API function
|
||||
* @param sem semaphore to wait on
|
||||
* @return ERR_OK if the function was called, another err_t if not
|
||||
*/
|
||||
err_t
|
||||
tcpip_send_msg_wait_sem(tcpip_callback_fn fn, void *apimsg, sys_sem_t* sem)
|
||||
{
|
||||
#if LWIP_TCPIP_CORE_LOCKING
|
||||
LWIP_UNUSED_ARG(sem);
|
||||
LOCK_TCPIP_CORE();
|
||||
fn(apimsg);
|
||||
UNLOCK_TCPIP_CORE();
|
||||
return ERR_OK;
|
||||
#else /* LWIP_TCPIP_CORE_LOCKING */
|
||||
TCPIP_MSG_VAR_DECLARE(msg);
|
||||
|
||||
LWIP_ASSERT("semaphore not initialized", sys_sem_valid(sem));
|
||||
LWIP_ASSERT("Invalid mbox", sys_mbox_valid_val(mbox));
|
||||
|
||||
TCPIP_MSG_VAR_ALLOC(msg);
|
||||
TCPIP_MSG_VAR_REF(msg).type = TCPIP_MSG_API;
|
||||
TCPIP_MSG_VAR_REF(msg).msg.api_msg.function = fn;
|
||||
TCPIP_MSG_VAR_REF(msg).msg.api_msg.msg = apimsg;
|
||||
sys_mbox_post(&mbox, &TCPIP_MSG_VAR_REF(msg));
|
||||
sys_arch_sem_wait(sem, 0);
|
||||
TCPIP_MSG_VAR_FREE(msg);
|
||||
return ERR_OK;
|
||||
#endif /* LWIP_TCPIP_CORE_LOCKING */
|
||||
}
|
||||
|
||||
/**
|
||||
* Synchronously calls function in TCPIP thread and waits for its completion.
|
||||
* It is recommended to use LWIP_TCPIP_CORE_LOCKING (preferred) or
|
||||
* LWIP_NETCONN_SEM_PER_THREAD.
|
||||
* If not, a semaphore is created and destroyed on every call which is usually
|
||||
* an expensive/slow operation.
|
||||
* @param fn Function to call
|
||||
* @param call Call parameters
|
||||
* @return Return value from tcpip_api_call_fn
|
||||
*/
|
||||
err_t
|
||||
tcpip_api_call(tcpip_api_call_fn fn, struct tcpip_api_call_data *call)
|
||||
{
|
||||
#if LWIP_TCPIP_CORE_LOCKING
|
||||
err_t err;
|
||||
LOCK_TCPIP_CORE();
|
||||
err = fn(call);
|
||||
UNLOCK_TCPIP_CORE();
|
||||
return err;
|
||||
#else /* LWIP_TCPIP_CORE_LOCKING */
|
||||
TCPIP_MSG_VAR_DECLARE(msg);
|
||||
err_t err;
|
||||
|
||||
LWIP_ASSERT("Invalid mbox", sys_mbox_valid_val(mbox));
|
||||
|
||||
#if !LWIP_NETCONN_SEM_PER_THREAD
|
||||
err = sys_sem_new(&call->sem, 0);
|
||||
if (err != ERR_OK) {
|
||||
return err;
|
||||
}
|
||||
#endif /* LWIP_NETCONN_SEM_PER_THREAD */
|
||||
|
||||
TCPIP_MSG_VAR_ALLOC(msg);
|
||||
TCPIP_MSG_VAR_REF(msg).type = TCPIP_MSG_API_CALL;
|
||||
TCPIP_MSG_VAR_REF(msg).msg.api_call.arg = call;
|
||||
TCPIP_MSG_VAR_REF(msg).msg.api_call.function = fn;
|
||||
#if LWIP_NETCONN_SEM_PER_THREAD
|
||||
TCPIP_MSG_VAR_REF(msg).msg.api_call.sem = LWIP_NETCONN_THREAD_SEM_GET();
|
||||
#else /* LWIP_NETCONN_SEM_PER_THREAD */
|
||||
TCPIP_MSG_VAR_REF(msg).msg.api_call.sem = &call->sem;
|
||||
#endif /* LWIP_NETCONN_SEM_PER_THREAD */
|
||||
sys_mbox_post(&mbox, &TCPIP_MSG_VAR_REF(msg));
|
||||
sys_arch_sem_wait(TCPIP_MSG_VAR_REF(msg).msg.api_call.sem, 0);
|
||||
TCPIP_MSG_VAR_FREE(msg);
|
||||
|
||||
#if !LWIP_NETCONN_SEM_PER_THREAD
|
||||
sys_sem_free(&call->sem);
|
||||
#endif /* LWIP_NETCONN_SEM_PER_THREAD */
|
||||
|
||||
return call->err;
|
||||
#endif /* LWIP_TCPIP_CORE_LOCKING */
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate a structure for a static callback message and initialize it.
|
||||
* This is intended to be used to send "static" messages from interrupt context.
|
||||
*
|
||||
* @param function the function to call
|
||||
* @param ctx parameter passed to function
|
||||
* @return a struct pointer to pass to tcpip_trycallback().
|
||||
*/
|
||||
struct tcpip_callback_msg*
|
||||
tcpip_callbackmsg_new(tcpip_callback_fn function, void *ctx)
|
||||
{
|
||||
struct tcpip_msg *msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API);
|
||||
if (msg == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
msg->type = TCPIP_MSG_CALLBACK_STATIC;
|
||||
msg->msg.cb.function = function;
|
||||
msg->msg.cb.ctx = ctx;
|
||||
return (struct tcpip_callback_msg*)msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Free a callback message allocated by tcpip_callbackmsg_new().
|
||||
*
|
||||
* @param msg the message to free
|
||||
*/
|
||||
void
|
||||
tcpip_callbackmsg_delete(struct tcpip_callback_msg* msg)
|
||||
tcpip_init(void (* initfunc)(void *), void *arg)
|
||||
{
|
||||
memp_free(MEMP_TCPIP_MSG_API, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Try to post a callback-message to the tcpip_thread mbox
|
||||
* This is intended to be used to send "static" messages from interrupt context.
|
||||
*
|
||||
* @param msg pointer to the message to post
|
||||
* @return sys_mbox_trypost() return code
|
||||
*/
|
||||
err_t
|
||||
tcpip_trycallback(struct tcpip_callback_msg* msg)
|
||||
{
|
||||
LWIP_ASSERT("Invalid mbox", sys_mbox_valid_val(mbox));
|
||||
return sys_mbox_trypost(&mbox, msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize this module:
|
||||
* - initialize all sub modules
|
||||
* - start the tcpip_thread
|
||||
*
|
||||
* @param initfunc a function to call when tcpip_thread is running and finished initializing
|
||||
* @param arg argument to pass to initfunc
|
||||
*/
|
||||
void
|
||||
tcpip_init(tcpip_init_done_fn initfunc, void *arg)
|
||||
{
|
||||
lwip_init();
|
||||
|
||||
tcpip_init_done = initfunc;
|
||||
tcpip_init_done_arg = arg;
|
||||
if (sys_mbox_new(&mbox, TCPIP_MBOX_SIZE) != ERR_OK) {
|
||||
LWIP_ASSERT("failed to create tcpip_thread mbox", 0);
|
||||
}
|
||||
#if LWIP_TCPIP_CORE_LOCKING
|
||||
if (sys_mutex_new(&lock_tcpip_core) != ERR_OK) {
|
||||
LWIP_ASSERT("failed to create lock_tcpip_core", 0);
|
||||
}
|
||||
#endif /* LWIP_TCPIP_CORE_LOCKING */
|
||||
|
||||
sys_thread_new(TCPIP_THREAD_NAME, tcpip_thread, NULL, TCPIP_THREAD_STACKSIZE, TCPIP_THREAD_PRIO);
|
||||
mbox = sys_mbox_new();
|
||||
sys_thread_new(tcpip_thread, NULL, TCPIP_THREAD_PRIO);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple callback function used with tcpip_callback to free a pbuf
|
||||
* (pbuf_free has a wrong signature for tcpip_callback)
|
||||
*
|
||||
* @param p The pbuf (chain) to be dereferenced.
|
||||
*/
|
||||
static void
|
||||
pbuf_free_int(void *p)
|
||||
{
|
||||
struct pbuf *q = (struct pbuf *)p;
|
||||
pbuf_free(q);
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple wrapper function that allows you to free a pbuf from interrupt context.
|
||||
*
|
||||
* @param p The pbuf (chain) to be dereferenced.
|
||||
* @return ERR_OK if callback could be enqueued, an err_t if not
|
||||
*/
|
||||
err_t
|
||||
pbuf_free_callback(struct pbuf *p)
|
||||
{
|
||||
return tcpip_callback_with_block(pbuf_free_int, p, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple wrapper function that allows you to free heap memory from
|
||||
* interrupt context.
|
||||
*
|
||||
* @param m the heap memory to free
|
||||
* @return ERR_OK if callback could be enqueued, an err_t if not
|
||||
*/
|
||||
err_t
|
||||
mem_free_callback(void *m)
|
||||
{
|
||||
return tcpip_callback_with_block(mem_free, m, 0);
|
||||
}
|
||||
|
||||
#endif /* !NO_SYS */
|
||||
|
||||
@@ -1,179 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2003 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Adam Dunkels <adam@sics.se>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/apps/httpd_opts.h"
|
||||
#include "lwip/def.h"
|
||||
#include "lwip/apps/fs.h"
|
||||
#include "fsdata.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#if HTTPD_USE_CUSTOM_FSDATA
|
||||
#include "fsdata_custom.c"
|
||||
#else /* HTTPD_USE_CUSTOM_FSDATA */
|
||||
#include "fsdata.c"
|
||||
#endif /* HTTPD_USE_CUSTOM_FSDATA */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
|
||||
#if LWIP_HTTPD_CUSTOM_FILES
|
||||
int fs_open_custom(struct fs_file *file, const char *name);
|
||||
void fs_close_custom(struct fs_file *file);
|
||||
#if LWIP_HTTPD_FS_ASYNC_READ
|
||||
u8_t fs_canread_custom(struct fs_file *file);
|
||||
u8_t fs_wait_read_custom(struct fs_file *file, fs_wait_cb callback_fn, void *callback_arg);
|
||||
int fs_read_async_custom(struct fs_file *file, char *buffer, int count, fs_wait_cb callback_fn, void *callback_arg);
|
||||
#else /* LWIP_HTTPD_FS_ASYNC_READ */
|
||||
int fs_read_custom(struct fs_file *file, char *buffer, int count);
|
||||
#endif /* LWIP_HTTPD_FS_ASYNC_READ */
|
||||
#endif /* LWIP_HTTPD_CUSTOM_FILES */
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
err_t
|
||||
fs_open(struct fs_file *file, const char *name)
|
||||
{
|
||||
const struct fsdata_file *f;
|
||||
|
||||
if ((file == NULL) || (name == NULL)) {
|
||||
return ERR_ARG;
|
||||
}
|
||||
|
||||
#if LWIP_HTTPD_CUSTOM_FILES
|
||||
if (fs_open_custom(file, name)) {
|
||||
file->is_custom_file = 1;
|
||||
return ERR_OK;
|
||||
}
|
||||
file->is_custom_file = 0;
|
||||
#endif /* LWIP_HTTPD_CUSTOM_FILES */
|
||||
|
||||
for (f = FS_ROOT; f != NULL; f = f->next) {
|
||||
if (!strcmp(name, (const char *)f->name)) {
|
||||
file->data = (const char *)f->data;
|
||||
file->len = f->len;
|
||||
file->index = f->len;
|
||||
file->pextension = NULL;
|
||||
file->flags = f->flags;
|
||||
#if HTTPD_PRECALCULATED_CHECKSUM
|
||||
file->chksum_count = f->chksum_count;
|
||||
file->chksum = f->chksum;
|
||||
#endif /* HTTPD_PRECALCULATED_CHECKSUM */
|
||||
#if LWIP_HTTPD_FILE_STATE
|
||||
file->state = fs_state_init(file, name);
|
||||
#endif /* #if LWIP_HTTPD_FILE_STATE */
|
||||
return ERR_OK;
|
||||
}
|
||||
}
|
||||
/* file not found */
|
||||
return ERR_VAL;
|
||||
}
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
fs_close(struct fs_file *file)
|
||||
{
|
||||
#if LWIP_HTTPD_CUSTOM_FILES
|
||||
if (file->is_custom_file) {
|
||||
fs_close_custom(file);
|
||||
}
|
||||
#endif /* LWIP_HTTPD_CUSTOM_FILES */
|
||||
#if LWIP_HTTPD_FILE_STATE
|
||||
fs_state_free(file, file->state);
|
||||
#endif /* #if LWIP_HTTPD_FILE_STATE */
|
||||
LWIP_UNUSED_ARG(file);
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
#if LWIP_HTTPD_DYNAMIC_FILE_READ
|
||||
#if LWIP_HTTPD_FS_ASYNC_READ
|
||||
int
|
||||
fs_read_async(struct fs_file *file, char *buffer, int count, fs_wait_cb callback_fn, void *callback_arg)
|
||||
#else /* LWIP_HTTPD_FS_ASYNC_READ */
|
||||
int
|
||||
fs_read(struct fs_file *file, char *buffer, int count)
|
||||
#endif /* LWIP_HTTPD_FS_ASYNC_READ */
|
||||
{
|
||||
int read;
|
||||
if(file->index == file->len) {
|
||||
return FS_READ_EOF;
|
||||
}
|
||||
#if LWIP_HTTPD_FS_ASYNC_READ
|
||||
LWIP_UNUSED_ARG(callback_fn);
|
||||
LWIP_UNUSED_ARG(callback_arg);
|
||||
#endif /* LWIP_HTTPD_FS_ASYNC_READ */
|
||||
#if LWIP_HTTPD_CUSTOM_FILES
|
||||
if (file->is_custom_file) {
|
||||
#if LWIP_HTTPD_FS_ASYNC_READ
|
||||
return fs_read_async_custom(file, buffer, count, callback_fn, callback_arg);
|
||||
#else /* LWIP_HTTPD_FS_ASYNC_READ */
|
||||
return fs_read_custom(file, buffer, count);
|
||||
#endif /* LWIP_HTTPD_FS_ASYNC_READ */
|
||||
}
|
||||
#endif /* LWIP_HTTPD_CUSTOM_FILES */
|
||||
|
||||
read = file->len - file->index;
|
||||
if(read > count) {
|
||||
read = count;
|
||||
}
|
||||
|
||||
MEMCPY(buffer, (file->data + file->index), read);
|
||||
file->index += read;
|
||||
|
||||
return(read);
|
||||
}
|
||||
#endif /* LWIP_HTTPD_DYNAMIC_FILE_READ */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
#if LWIP_HTTPD_FS_ASYNC_READ
|
||||
int
|
||||
fs_is_file_ready(struct fs_file *file, fs_wait_cb callback_fn, void *callback_arg)
|
||||
{
|
||||
if (file != NULL) {
|
||||
#if LWIP_HTTPD_FS_ASYNC_READ
|
||||
#if LWIP_HTTPD_CUSTOM_FILES
|
||||
if (!fs_canread_custom(file)) {
|
||||
if (fs_wait_read_custom(file, callback_fn, callback_arg)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#else /* LWIP_HTTPD_CUSTOM_FILES */
|
||||
LWIP_UNUSED_ARG(callback_fn);
|
||||
LWIP_UNUSED_ARG(callback_arg);
|
||||
#endif /* LWIP_HTTPD_CUSTOM_FILES */
|
||||
#endif /* LWIP_HTTPD_FS_ASYNC_READ */
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#endif /* LWIP_HTTPD_FS_ASYNC_READ */
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
int
|
||||
fs_bytes_left(struct fs_file *file)
|
||||
{
|
||||
return file->len - file->index;
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
<html>
|
||||
<head><title>lwIP - A Lightweight TCP/IP Stack</title></head>
|
||||
<body bgcolor="white" text="black">
|
||||
|
||||
<table width="100%">
|
||||
<tr valign="top"><td width="80">
|
||||
<a href="http://www.sics.se/"><img src="/img/sics.gif"
|
||||
border="0" alt="SICS logo" title="SICS logo"></a>
|
||||
</td><td width="500">
|
||||
<h1>lwIP - A Lightweight TCP/IP Stack</h1>
|
||||
<h2>404 - Page not found</h2>
|
||||
<p>
|
||||
Sorry, the page you are requesting was not found on this
|
||||
server.
|
||||
</p>
|
||||
</td><td>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 724 B |
@@ -1,47 +0,0 @@
|
||||
<html>
|
||||
<head><title>lwIP - A Lightweight TCP/IP Stack</title></head>
|
||||
<body bgcolor="white" text="black">
|
||||
|
||||
<table width="100%">
|
||||
<tr valign="top"><td width="80">
|
||||
<a href="http://www.sics.se/"><img src="/img/sics.gif"
|
||||
border="0" alt="SICS logo" title="SICS logo"></a>
|
||||
</td><td width="500">
|
||||
<h1>lwIP - A Lightweight TCP/IP Stack</h1>
|
||||
<p>
|
||||
The web page you are watching was served by a simple web
|
||||
server running on top of the lightweight TCP/IP stack <a
|
||||
href="http://www.sics.se/~adam/lwip/">lwIP</a>.
|
||||
</p>
|
||||
<p>
|
||||
lwIP is an open source implementation of the TCP/IP
|
||||
protocol suite that was originally written by <a
|
||||
href="http://www.sics.se/~adam/lwip/">Adam Dunkels
|
||||
of the Swedish Institute of Computer Science</a> but now is
|
||||
being actively developed by a team of developers
|
||||
distributed world-wide. Since it's release, lwIP has
|
||||
spurred a lot of interest and has been ported to several
|
||||
platforms and operating systems. lwIP can be used either
|
||||
with or without an underlying OS.
|
||||
</p>
|
||||
<p>
|
||||
The focus of the lwIP TCP/IP implementation is to reduce
|
||||
the RAM usage while still having a full scale TCP. This
|
||||
makes lwIP suitable for use in embedded systems with tens
|
||||
of kilobytes of free RAM and room for around 40 kilobytes
|
||||
of code ROM.
|
||||
</p>
|
||||
<p>
|
||||
More information about lwIP can be found at the lwIP
|
||||
homepage at <a
|
||||
href="http://savannah.nongnu.org/projects/lwip/">http://savannah.nongnu.org/projects/lwip/</a>
|
||||
or at the lwIP wiki at <a
|
||||
href="http://lwip.wikia.com/">http://lwip.wikia.com/</a>.
|
||||
</p>
|
||||
</td><td>
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,298 +0,0 @@
|
||||
#include "lwip/apps/fs.h"
|
||||
#include "lwip/def.h"
|
||||
#include "fsdata.h"
|
||||
|
||||
|
||||
#define file_NULL (struct fsdata_file *) NULL
|
||||
|
||||
|
||||
static const unsigned int dummy_align__img_sics_gif = 0;
|
||||
static const unsigned char data__img_sics_gif[] = {
|
||||
/* /img/sics.gif (14 chars) */
|
||||
0x2f,0x69,0x6d,0x67,0x2f,0x73,0x69,0x63,0x73,0x2e,0x67,0x69,0x66,0x00,0x00,0x00,
|
||||
|
||||
/* HTTP header */
|
||||
/* "HTTP/1.0 200 OK
|
||||
" (17 bytes) */
|
||||
0x48,0x54,0x54,0x50,0x2f,0x31,0x2e,0x30,0x20,0x32,0x30,0x30,0x20,0x4f,0x4b,0x0d,
|
||||
0x0a,
|
||||
/* "Server: lwIP/1.3.1 (http://savannah.nongnu.org/projects/lwip)
|
||||
" (63 bytes) */
|
||||
0x53,0x65,0x72,0x76,0x65,0x72,0x3a,0x20,0x6c,0x77,0x49,0x50,0x2f,0x31,0x2e,0x33,
|
||||
0x2e,0x31,0x20,0x28,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x73,0x61,0x76,0x61,0x6e,
|
||||
0x6e,0x61,0x68,0x2e,0x6e,0x6f,0x6e,0x67,0x6e,0x75,0x2e,0x6f,0x72,0x67,0x2f,0x70,
|
||||
0x72,0x6f,0x6a,0x65,0x63,0x74,0x73,0x2f,0x6c,0x77,0x69,0x70,0x29,0x0d,0x0a,
|
||||
/* "Content-type: image/gif
|
||||
|
||||
" (27 bytes) */
|
||||
0x43,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x74,0x79,0x70,0x65,0x3a,0x20,0x69,0x6d,
|
||||
0x61,0x67,0x65,0x2f,0x67,0x69,0x66,0x0d,0x0a,0x0d,0x0a,
|
||||
/* raw file data (724 bytes) */
|
||||
0x47,0x49,0x46,0x38,0x39,0x61,0x46,0x00,0x22,0x00,0xa5,0x00,0x00,0xd9,0x2b,0x39,
|
||||
0x6a,0x6a,0x6a,0xbf,0xbf,0xbf,0x93,0x93,0x93,0x0f,0x0f,0x0f,0xb0,0xb0,0xb0,0xa6,
|
||||
0xa6,0xa6,0x80,0x80,0x80,0x76,0x76,0x76,0x1e,0x1e,0x1e,0x9d,0x9d,0x9d,0x2e,0x2e,
|
||||
0x2e,0x49,0x49,0x49,0x54,0x54,0x54,0x8a,0x8a,0x8a,0x60,0x60,0x60,0xc6,0xa6,0x99,
|
||||
0xbd,0xb5,0xb2,0xc2,0xab,0xa1,0xd9,0x41,0x40,0xd5,0x67,0x55,0xc0,0xb0,0xaa,0xd5,
|
||||
0x5e,0x4e,0xd6,0x50,0x45,0xcc,0x93,0x7d,0xc8,0xa1,0x90,0xce,0x8b,0x76,0xd2,0x7b,
|
||||
0x65,0xd1,0x84,0x6d,0xc9,0x99,0x86,0x3a,0x3a,0x3a,0x00,0x00,0x00,0xb8,0xb8,0xb8,
|
||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2c,0x00,0x00,
|
||||
0x00,0x00,0x46,0x00,0x22,0x00,0x00,0x06,0xfe,0x40,0x90,0x70,0x48,0x2c,0x1a,0x8f,
|
||||
0xc8,0xa4,0x72,0xc9,0x6c,0x3a,0x9f,0xd0,0xa8,0x74,0x4a,0xad,0x5a,0xaf,0xd8,0xac,
|
||||
0x76,0xa9,0x40,0x04,0xbe,0x83,0xe2,0x60,0x3c,0x50,0x20,0x0d,0x8e,0x6f,0x00,0x31,
|
||||
0x28,0x1c,0x0d,0x07,0xb5,0xc3,0x60,0x75,0x24,0x3e,0xf8,0xfc,0x87,0x11,0x06,0xe9,
|
||||
0x3d,0x46,0x07,0x0b,0x7a,0x7a,0x7c,0x43,0x06,0x1e,0x84,0x78,0x0b,0x07,0x6e,0x51,
|
||||
0x01,0x8a,0x84,0x08,0x7e,0x79,0x80,0x87,0x89,0x91,0x7a,0x93,0x0a,0x04,0x99,0x78,
|
||||
0x96,0x4f,0x03,0x9e,0x79,0x01,0x94,0x9f,0x43,0x9c,0xa3,0xa4,0x05,0x77,0xa3,0xa0,
|
||||
0x4e,0x98,0x79,0x0b,0x1e,0x83,0xa4,0xa6,0x1f,0x96,0x05,0x9d,0xaa,0x78,0x01,0x07,
|
||||
0x84,0x04,0x1e,0x1e,0xbb,0xb8,0x51,0x84,0x0e,0x43,0x05,0x07,0x77,0xa5,0x7f,0x42,
|
||||
0xb1,0xb2,0x01,0x63,0x08,0x0d,0xbb,0x01,0x0c,0x7a,0x0d,0x44,0x0e,0xd8,0xaf,0x4c,
|
||||
0x05,0x7a,0x04,0x47,0x07,0x07,0xb7,0x80,0xa2,0xe1,0x7d,0x44,0x05,0x01,0x04,0x01,
|
||||
0xd0,0xea,0x87,0x93,0x4f,0xe0,0x9a,0x49,0xce,0xd8,0x79,0x04,0x66,0x20,0x15,0x10,
|
||||
0x10,0x11,0x92,0x29,0x80,0xb6,0xc0,0x91,0x15,0x45,0x1e,0x90,0x19,0x71,0x46,0xa8,
|
||||
0x5c,0x04,0x0e,0x00,0x22,0x4e,0xe8,0x40,0x24,0x9f,0x3e,0x04,0x06,0xa7,0x58,0xd4,
|
||||
0x93,0xa0,0x1c,0x91,0x3f,0xe8,0xf0,0x88,0x03,0xb1,0x21,0xa2,0x49,0x00,0x19,0x86,
|
||||
0xfc,0x52,0x44,0xe0,0x01,0x9d,0x29,0x21,0x15,0x25,0x50,0xf7,0x67,0x25,0x1e,0x06,
|
||||
0xfd,0x4e,0x9a,0xb4,0x90,0xac,0x15,0xfa,0xcb,0x52,0x53,0x1e,0x8c,0xf2,0xf8,0x07,
|
||||
0x92,0x2d,0x08,0x3a,0x4d,0x12,0x49,0x95,0x49,0xdb,0x14,0x04,0xc4,0x14,0x85,0x29,
|
||||
0xaa,0xe7,0x01,0x08,0xa4,0x49,0x01,0x14,0x51,0xe0,0x53,0x91,0xd5,0x29,0x06,0x1a,
|
||||
0x64,0x02,0xf4,0xc7,0x81,0x9e,0x05,0x20,0x22,0x64,0xa5,0x30,0xae,0xab,0x9e,0x97,
|
||||
0x53,0xd8,0xb9,0xfd,0x50,0xef,0x93,0x02,0x42,0x74,0x34,0xe8,0x9c,0x20,0x21,0xc9,
|
||||
0x01,0x68,0x78,0xe6,0x55,0x29,0x20,0x56,0x4f,0x4c,0x40,0x51,0x71,0x82,0xc0,0x70,
|
||||
0x21,0x22,0x85,0xbe,0x4b,0x1c,0x44,0x05,0xea,0xa4,0x01,0xbf,0x22,0xb5,0xf0,0x1c,
|
||||
0x06,0x51,0x38,0x8f,0xe0,0x22,0xec,0x18,0xac,0x39,0x22,0xd4,0xd6,0x93,0x44,0x01,
|
||||
0x32,0x82,0xc8,0xfc,0x61,0xb3,0x01,0x45,0x0c,0x2e,0x83,0x30,0xd0,0x0e,0x17,0x24,
|
||||
0x0f,0x70,0x85,0x94,0xee,0x05,0x05,0x53,0x4b,0x32,0x1b,0x3f,0x98,0xd3,0x1d,0x29,
|
||||
0x81,0xb0,0xae,0x1e,0x8c,0x7e,0x68,0xe0,0x60,0x5a,0x54,0x8f,0xb0,0x78,0x69,0x73,
|
||||
0x06,0xa2,0x00,0x6b,0x57,0xca,0x3d,0x11,0x50,0xbd,0x04,0x30,0x4b,0x3a,0xd4,0xab,
|
||||
0x5f,0x1f,0x9b,0x3d,0x13,0x74,0x27,0x88,0x3c,0x25,0xe0,0x17,0xbe,0x7a,0x79,0x45,
|
||||
0x0d,0x0c,0xb0,0x8b,0xda,0x90,0xca,0x80,0x06,0x5d,0x17,0x60,0x1c,0x22,0x4c,0xd8,
|
||||
0x57,0x22,0x06,0x20,0x00,0x98,0x07,0x08,0xe4,0x56,0x80,0x80,0x1c,0xc5,0xb7,0xc5,
|
||||
0x82,0x0c,0x36,0xe8,0xe0,0x83,0x10,0x46,0x28,0xe1,0x84,0x14,0x56,0x68,0xa1,0x10,
|
||||
0x41,0x00,0x00,0x3b,};
|
||||
|
||||
static const unsigned int dummy_align__404_html = 1;
|
||||
static const unsigned char data__404_html[] = {
|
||||
/* /404.html (10 chars) */
|
||||
0x2f,0x34,0x30,0x34,0x2e,0x68,0x74,0x6d,0x6c,0x00,0x00,0x00,
|
||||
|
||||
/* HTTP header */
|
||||
/* "HTTP/1.0 404 File not found
|
||||
" (29 bytes) */
|
||||
0x48,0x54,0x54,0x50,0x2f,0x31,0x2e,0x30,0x20,0x34,0x30,0x34,0x20,0x46,0x69,0x6c,
|
||||
0x65,0x20,0x6e,0x6f,0x74,0x20,0x66,0x6f,0x75,0x6e,0x64,0x0d,0x0a,
|
||||
/* "Server: lwIP/1.3.1 (http://savannah.nongnu.org/projects/lwip)
|
||||
" (63 bytes) */
|
||||
0x53,0x65,0x72,0x76,0x65,0x72,0x3a,0x20,0x6c,0x77,0x49,0x50,0x2f,0x31,0x2e,0x33,
|
||||
0x2e,0x31,0x20,0x28,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x73,0x61,0x76,0x61,0x6e,
|
||||
0x6e,0x61,0x68,0x2e,0x6e,0x6f,0x6e,0x67,0x6e,0x75,0x2e,0x6f,0x72,0x67,0x2f,0x70,
|
||||
0x72,0x6f,0x6a,0x65,0x63,0x74,0x73,0x2f,0x6c,0x77,0x69,0x70,0x29,0x0d,0x0a,
|
||||
/* "Content-type: text/html
|
||||
|
||||
" (27 bytes) */
|
||||
0x43,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x74,0x79,0x70,0x65,0x3a,0x20,0x74,0x65,
|
||||
0x78,0x74,0x2f,0x68,0x74,0x6d,0x6c,0x0d,0x0a,0x0d,0x0a,
|
||||
/* raw file data (565 bytes) */
|
||||
0x3c,0x68,0x74,0x6d,0x6c,0x3e,0x0d,0x0a,0x3c,0x68,0x65,0x61,0x64,0x3e,0x3c,0x74,
|
||||
0x69,0x74,0x6c,0x65,0x3e,0x6c,0x77,0x49,0x50,0x20,0x2d,0x20,0x41,0x20,0x4c,0x69,
|
||||
0x67,0x68,0x74,0x77,0x65,0x69,0x67,0x68,0x74,0x20,0x54,0x43,0x50,0x2f,0x49,0x50,
|
||||
0x20,0x53,0x74,0x61,0x63,0x6b,0x3c,0x2f,0x74,0x69,0x74,0x6c,0x65,0x3e,0x3c,0x2f,
|
||||
0x68,0x65,0x61,0x64,0x3e,0x0d,0x0a,0x3c,0x62,0x6f,0x64,0x79,0x20,0x62,0x67,0x63,
|
||||
0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x77,0x68,0x69,0x74,0x65,0x22,0x20,0x74,0x65,0x78,
|
||||
0x74,0x3d,0x22,0x62,0x6c,0x61,0x63,0x6b,0x22,0x3e,0x0d,0x0a,0x0d,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x3c,0x74,0x61,0x62,0x6c,0x65,0x20,0x77,0x69,0x64,0x74,0x68,0x3d,0x22,
|
||||
0x31,0x30,0x30,0x25,0x22,0x3e,0x0d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x74,
|
||||
0x72,0x20,0x76,0x61,0x6c,0x69,0x67,0x6e,0x3d,0x22,0x74,0x6f,0x70,0x22,0x3e,0x3c,
|
||||
0x74,0x64,0x20,0x77,0x69,0x64,0x74,0x68,0x3d,0x22,0x38,0x30,0x22,0x3e,0x09,0x20,
|
||||
0x20,0x0d,0x0a,0x09,0x20,0x20,0x3c,0x61,0x20,0x68,0x72,0x65,0x66,0x3d,0x22,0x68,
|
||||
0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x73,0x69,0x63,0x73,0x2e,0x73,
|
||||
0x65,0x2f,0x22,0x3e,0x3c,0x69,0x6d,0x67,0x20,0x73,0x72,0x63,0x3d,0x22,0x2f,0x69,
|
||||
0x6d,0x67,0x2f,0x73,0x69,0x63,0x73,0x2e,0x67,0x69,0x66,0x22,0x0d,0x0a,0x09,0x20,
|
||||
0x20,0x62,0x6f,0x72,0x64,0x65,0x72,0x3d,0x22,0x30,0x22,0x20,0x61,0x6c,0x74,0x3d,
|
||||
0x22,0x53,0x49,0x43,0x53,0x20,0x6c,0x6f,0x67,0x6f,0x22,0x20,0x74,0x69,0x74,0x6c,
|
||||
0x65,0x3d,0x22,0x53,0x49,0x43,0x53,0x20,0x6c,0x6f,0x67,0x6f,0x22,0x3e,0x3c,0x2f,
|
||||
0x61,0x3e,0x0d,0x0a,0x09,0x3c,0x2f,0x74,0x64,0x3e,0x3c,0x74,0x64,0x20,0x77,0x69,
|
||||
0x64,0x74,0x68,0x3d,0x22,0x35,0x30,0x30,0x22,0x3e,0x09,0x20,0x20,0x0d,0x0a,0x09,
|
||||
0x20,0x20,0x3c,0x68,0x31,0x3e,0x6c,0x77,0x49,0x50,0x20,0x2d,0x20,0x41,0x20,0x4c,
|
||||
0x69,0x67,0x68,0x74,0x77,0x65,0x69,0x67,0x68,0x74,0x20,0x54,0x43,0x50,0x2f,0x49,
|
||||
0x50,0x20,0x53,0x74,0x61,0x63,0x6b,0x3c,0x2f,0x68,0x31,0x3e,0x0d,0x0a,0x09,0x20,
|
||||
0x20,0x3c,0x68,0x32,0x3e,0x34,0x30,0x34,0x20,0x2d,0x20,0x50,0x61,0x67,0x65,0x20,
|
||||
0x6e,0x6f,0x74,0x20,0x66,0x6f,0x75,0x6e,0x64,0x3c,0x2f,0x68,0x32,0x3e,0x0d,0x0a,
|
||||
0x09,0x20,0x20,0x3c,0x70,0x3e,0x0d,0x0a,0x09,0x20,0x20,0x20,0x20,0x53,0x6f,0x72,
|
||||
0x72,0x79,0x2c,0x20,0x74,0x68,0x65,0x20,0x70,0x61,0x67,0x65,0x20,0x79,0x6f,0x75,
|
||||
0x20,0x61,0x72,0x65,0x20,0x72,0x65,0x71,0x75,0x65,0x73,0x74,0x69,0x6e,0x67,0x20,
|
||||
0x77,0x61,0x73,0x20,0x6e,0x6f,0x74,0x20,0x66,0x6f,0x75,0x6e,0x64,0x20,0x6f,0x6e,
|
||||
0x20,0x74,0x68,0x69,0x73,0x0d,0x0a,0x09,0x20,0x20,0x20,0x20,0x73,0x65,0x72,0x76,
|
||||
0x65,0x72,0x2e,0x20,0x0d,0x0a,0x09,0x20,0x20,0x3c,0x2f,0x70,0x3e,0x0d,0x0a,0x09,
|
||||
0x3c,0x2f,0x74,0x64,0x3e,0x3c,0x74,0x64,0x3e,0x0d,0x0a,0x09,0x20,0x20,0x26,0x6e,
|
||||
0x62,0x73,0x70,0x3b,0x0d,0x0a,0x09,0x3c,0x2f,0x74,0x64,0x3e,0x3c,0x2f,0x74,0x72,
|
||||
0x3e,0x0d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x2f,0x74,0x61,0x62,0x6c,0x65,
|
||||
0x3e,0x0d,0x0a,0x3c,0x2f,0x62,0x6f,0x64,0x79,0x3e,0x0d,0x0a,0x3c,0x2f,0x68,0x74,
|
||||
0x6d,0x6c,0x3e,0x0d,0x0a,};
|
||||
|
||||
static const unsigned int dummy_align__index_html = 2;
|
||||
static const unsigned char data__index_html[] = {
|
||||
/* /index.html (12 chars) */
|
||||
0x2f,0x69,0x6e,0x64,0x65,0x78,0x2e,0x68,0x74,0x6d,0x6c,0x00,
|
||||
|
||||
/* HTTP header */
|
||||
/* "HTTP/1.0 200 OK
|
||||
" (17 bytes) */
|
||||
0x48,0x54,0x54,0x50,0x2f,0x31,0x2e,0x30,0x20,0x32,0x30,0x30,0x20,0x4f,0x4b,0x0d,
|
||||
0x0a,
|
||||
/* "Server: lwIP/1.3.1 (http://savannah.nongnu.org/projects/lwip)
|
||||
" (63 bytes) */
|
||||
0x53,0x65,0x72,0x76,0x65,0x72,0x3a,0x20,0x6c,0x77,0x49,0x50,0x2f,0x31,0x2e,0x33,
|
||||
0x2e,0x31,0x20,0x28,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x73,0x61,0x76,0x61,0x6e,
|
||||
0x6e,0x61,0x68,0x2e,0x6e,0x6f,0x6e,0x67,0x6e,0x75,0x2e,0x6f,0x72,0x67,0x2f,0x70,
|
||||
0x72,0x6f,0x6a,0x65,0x63,0x74,0x73,0x2f,0x6c,0x77,0x69,0x70,0x29,0x0d,0x0a,
|
||||
/* "Content-type: text/html
|
||||
|
||||
" (27 bytes) */
|
||||
0x43,0x6f,0x6e,0x74,0x65,0x6e,0x74,0x2d,0x74,0x79,0x70,0x65,0x3a,0x20,0x74,0x65,
|
||||
0x78,0x74,0x2f,0x68,0x74,0x6d,0x6c,0x0d,0x0a,0x0d,0x0a,
|
||||
/* raw file data (1751 bytes) */
|
||||
0x3c,0x68,0x74,0x6d,0x6c,0x3e,0x0d,0x0a,0x3c,0x68,0x65,0x61,0x64,0x3e,0x3c,0x74,
|
||||
0x69,0x74,0x6c,0x65,0x3e,0x6c,0x77,0x49,0x50,0x20,0x2d,0x20,0x41,0x20,0x4c,0x69,
|
||||
0x67,0x68,0x74,0x77,0x65,0x69,0x67,0x68,0x74,0x20,0x54,0x43,0x50,0x2f,0x49,0x50,
|
||||
0x20,0x53,0x74,0x61,0x63,0x6b,0x3c,0x2f,0x74,0x69,0x74,0x6c,0x65,0x3e,0x3c,0x2f,
|
||||
0x68,0x65,0x61,0x64,0x3e,0x0d,0x0a,0x3c,0x62,0x6f,0x64,0x79,0x20,0x62,0x67,0x63,
|
||||
0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x77,0x68,0x69,0x74,0x65,0x22,0x20,0x74,0x65,0x78,
|
||||
0x74,0x3d,0x22,0x62,0x6c,0x61,0x63,0x6b,0x22,0x3e,0x0d,0x0a,0x0d,0x0a,0x20,0x20,
|
||||
0x20,0x20,0x3c,0x74,0x61,0x62,0x6c,0x65,0x20,0x77,0x69,0x64,0x74,0x68,0x3d,0x22,
|
||||
0x31,0x30,0x30,0x25,0x22,0x3e,0x0d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x74,
|
||||
0x72,0x20,0x76,0x61,0x6c,0x69,0x67,0x6e,0x3d,0x22,0x74,0x6f,0x70,0x22,0x3e,0x3c,
|
||||
0x74,0x64,0x20,0x77,0x69,0x64,0x74,0x68,0x3d,0x22,0x38,0x30,0x22,0x3e,0x09,0x20,
|
||||
0x20,0x0d,0x0a,0x09,0x20,0x20,0x3c,0x61,0x20,0x68,0x72,0x65,0x66,0x3d,0x22,0x68,
|
||||
0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x73,0x69,0x63,0x73,0x2e,0x73,
|
||||
0x65,0x2f,0x22,0x3e,0x3c,0x69,0x6d,0x67,0x20,0x73,0x72,0x63,0x3d,0x22,0x2f,0x69,
|
||||
0x6d,0x67,0x2f,0x73,0x69,0x63,0x73,0x2e,0x67,0x69,0x66,0x22,0x0d,0x0a,0x09,0x20,
|
||||
0x20,0x62,0x6f,0x72,0x64,0x65,0x72,0x3d,0x22,0x30,0x22,0x20,0x61,0x6c,0x74,0x3d,
|
||||
0x22,0x53,0x49,0x43,0x53,0x20,0x6c,0x6f,0x67,0x6f,0x22,0x20,0x74,0x69,0x74,0x6c,
|
||||
0x65,0x3d,0x22,0x53,0x49,0x43,0x53,0x20,0x6c,0x6f,0x67,0x6f,0x22,0x3e,0x3c,0x2f,
|
||||
0x61,0x3e,0x0d,0x0a,0x09,0x3c,0x2f,0x74,0x64,0x3e,0x3c,0x74,0x64,0x20,0x77,0x69,
|
||||
0x64,0x74,0x68,0x3d,0x22,0x35,0x30,0x30,0x22,0x3e,0x09,0x20,0x20,0x0d,0x0a,0x09,
|
||||
0x20,0x20,0x3c,0x68,0x31,0x3e,0x6c,0x77,0x49,0x50,0x20,0x2d,0x20,0x41,0x20,0x4c,
|
||||
0x69,0x67,0x68,0x74,0x77,0x65,0x69,0x67,0x68,0x74,0x20,0x54,0x43,0x50,0x2f,0x49,
|
||||
0x50,0x20,0x53,0x74,0x61,0x63,0x6b,0x3c,0x2f,0x68,0x31,0x3e,0x0d,0x0a,0x09,0x20,
|
||||
0x20,0x3c,0x70,0x3e,0x0d,0x0a,0x09,0x20,0x20,0x20,0x20,0x54,0x68,0x65,0x20,0x77,
|
||||
0x65,0x62,0x20,0x70,0x61,0x67,0x65,0x20,0x79,0x6f,0x75,0x20,0x61,0x72,0x65,0x20,
|
||||
0x77,0x61,0x74,0x63,0x68,0x69,0x6e,0x67,0x20,0x77,0x61,0x73,0x20,0x73,0x65,0x72,
|
||||
0x76,0x65,0x64,0x20,0x62,0x79,0x20,0x61,0x20,0x73,0x69,0x6d,0x70,0x6c,0x65,0x20,
|
||||
0x77,0x65,0x62,0x0d,0x0a,0x09,0x20,0x20,0x20,0x20,0x73,0x65,0x72,0x76,0x65,0x72,
|
||||
0x20,0x72,0x75,0x6e,0x6e,0x69,0x6e,0x67,0x20,0x6f,0x6e,0x20,0x74,0x6f,0x70,0x20,
|
||||
0x6f,0x66,0x20,0x74,0x68,0x65,0x20,0x6c,0x69,0x67,0x68,0x74,0x77,0x65,0x69,0x67,
|
||||
0x68,0x74,0x20,0x54,0x43,0x50,0x2f,0x49,0x50,0x20,0x73,0x74,0x61,0x63,0x6b,0x20,
|
||||
0x3c,0x61,0x0d,0x0a,0x09,0x20,0x20,0x20,0x20,0x68,0x72,0x65,0x66,0x3d,0x22,0x68,
|
||||
0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x73,0x69,0x63,0x73,0x2e,0x73,
|
||||
0x65,0x2f,0x7e,0x61,0x64,0x61,0x6d,0x2f,0x6c,0x77,0x69,0x70,0x2f,0x22,0x3e,0x6c,
|
||||
0x77,0x49,0x50,0x3c,0x2f,0x61,0x3e,0x2e,0x0d,0x0a,0x09,0x20,0x20,0x3c,0x2f,0x70,
|
||||
0x3e,0x0d,0x0a,0x09,0x20,0x20,0x3c,0x70,0x3e,0x0d,0x0a,0x09,0x20,0x20,0x20,0x20,
|
||||
0x6c,0x77,0x49,0x50,0x20,0x69,0x73,0x20,0x61,0x6e,0x20,0x6f,0x70,0x65,0x6e,0x20,
|
||||
0x73,0x6f,0x75,0x72,0x63,0x65,0x20,0x69,0x6d,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,
|
||||
0x61,0x74,0x69,0x6f,0x6e,0x20,0x6f,0x66,0x20,0x74,0x68,0x65,0x20,0x54,0x43,0x50,
|
||||
0x2f,0x49,0x50,0x0d,0x0a,0x09,0x20,0x20,0x20,0x20,0x70,0x72,0x6f,0x74,0x6f,0x63,
|
||||
0x6f,0x6c,0x20,0x73,0x75,0x69,0x74,0x65,0x20,0x74,0x68,0x61,0x74,0x20,0x77,0x61,
|
||||
0x73,0x20,0x6f,0x72,0x69,0x67,0x69,0x6e,0x61,0x6c,0x6c,0x79,0x20,0x77,0x72,0x69,
|
||||
0x74,0x74,0x65,0x6e,0x20,0x62,0x79,0x20,0x3c,0x61,0x0d,0x0a,0x09,0x20,0x20,0x20,
|
||||
0x20,0x68,0x72,0x65,0x66,0x3d,0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x77,
|
||||
0x77,0x2e,0x73,0x69,0x63,0x73,0x2e,0x73,0x65,0x2f,0x7e,0x61,0x64,0x61,0x6d,0x2f,
|
||||
0x6c,0x77,0x69,0x70,0x2f,0x22,0x3e,0x41,0x64,0x61,0x6d,0x20,0x44,0x75,0x6e,0x6b,
|
||||
0x65,0x6c,0x73,0x0d,0x0a,0x09,0x20,0x20,0x20,0x20,0x6f,0x66,0x20,0x74,0x68,0x65,
|
||||
0x20,0x53,0x77,0x65,0x64,0x69,0x73,0x68,0x20,0x49,0x6e,0x73,0x74,0x69,0x74,0x75,
|
||||
0x74,0x65,0x20,0x6f,0x66,0x20,0x43,0x6f,0x6d,0x70,0x75,0x74,0x65,0x72,0x20,0x53,
|
||||
0x63,0x69,0x65,0x6e,0x63,0x65,0x3c,0x2f,0x61,0x3e,0x20,0x62,0x75,0x74,0x20,0x6e,
|
||||
0x6f,0x77,0x20,0x69,0x73,0x0d,0x0a,0x09,0x20,0x20,0x20,0x20,0x62,0x65,0x69,0x6e,
|
||||
0x67,0x20,0x61,0x63,0x74,0x69,0x76,0x65,0x6c,0x79,0x20,0x64,0x65,0x76,0x65,0x6c,
|
||||
0x6f,0x70,0x65,0x64,0x20,0x62,0x79,0x20,0x61,0x20,0x74,0x65,0x61,0x6d,0x20,0x6f,
|
||||
0x66,0x20,0x64,0x65,0x76,0x65,0x6c,0x6f,0x70,0x65,0x72,0x73,0x0d,0x0a,0x09,0x20,
|
||||
0x20,0x20,0x20,0x64,0x69,0x73,0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x64,0x20,0x77,
|
||||
0x6f,0x72,0x6c,0x64,0x2d,0x77,0x69,0x64,0x65,0x2e,0x20,0x53,0x69,0x6e,0x63,0x65,
|
||||
0x20,0x69,0x74,0x27,0x73,0x20,0x72,0x65,0x6c,0x65,0x61,0x73,0x65,0x2c,0x20,0x6c,
|
||||
0x77,0x49,0x50,0x20,0x68,0x61,0x73,0x0d,0x0a,0x09,0x20,0x20,0x20,0x20,0x73,0x70,
|
||||
0x75,0x72,0x72,0x65,0x64,0x20,0x61,0x20,0x6c,0x6f,0x74,0x20,0x6f,0x66,0x20,0x69,
|
||||
0x6e,0x74,0x65,0x72,0x65,0x73,0x74,0x20,0x61,0x6e,0x64,0x20,0x68,0x61,0x73,0x20,
|
||||
0x62,0x65,0x65,0x6e,0x20,0x70,0x6f,0x72,0x74,0x65,0x64,0x20,0x74,0x6f,0x20,0x73,
|
||||
0x65,0x76,0x65,0x72,0x61,0x6c,0x0d,0x0a,0x09,0x20,0x20,0x20,0x20,0x70,0x6c,0x61,
|
||||
0x74,0x66,0x6f,0x72,0x6d,0x73,0x20,0x61,0x6e,0x64,0x20,0x6f,0x70,0x65,0x72,0x61,
|
||||
0x74,0x69,0x6e,0x67,0x20,0x73,0x79,0x73,0x74,0x65,0x6d,0x73,0x2e,0x20,0x6c,0x77,
|
||||
0x49,0x50,0x20,0x63,0x61,0x6e,0x20,0x62,0x65,0x20,0x75,0x73,0x65,0x64,0x20,0x65,
|
||||
0x69,0x74,0x68,0x65,0x72,0x0d,0x0a,0x09,0x20,0x20,0x20,0x20,0x77,0x69,0x74,0x68,
|
||||
0x20,0x6f,0x72,0x20,0x77,0x69,0x74,0x68,0x6f,0x75,0x74,0x20,0x61,0x6e,0x20,0x75,
|
||||
0x6e,0x64,0x65,0x72,0x6c,0x79,0x69,0x6e,0x67,0x20,0x4f,0x53,0x2e,0x0d,0x0a,0x09,
|
||||
0x20,0x20,0x3c,0x2f,0x70,0x3e,0x0d,0x0a,0x09,0x20,0x20,0x3c,0x70,0x3e,0x0d,0x0a,
|
||||
0x09,0x20,0x20,0x20,0x20,0x54,0x68,0x65,0x20,0x66,0x6f,0x63,0x75,0x73,0x20,0x6f,
|
||||
0x66,0x20,0x74,0x68,0x65,0x20,0x6c,0x77,0x49,0x50,0x20,0x54,0x43,0x50,0x2f,0x49,
|
||||
0x50,0x20,0x69,0x6d,0x70,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x61,0x74,0x69,0x6f,0x6e,
|
||||
0x20,0x69,0x73,0x20,0x74,0x6f,0x20,0x72,0x65,0x64,0x75,0x63,0x65,0x0d,0x0a,0x09,
|
||||
0x20,0x20,0x20,0x20,0x74,0x68,0x65,0x20,0x52,0x41,0x4d,0x20,0x75,0x73,0x61,0x67,
|
||||
0x65,0x20,0x77,0x68,0x69,0x6c,0x65,0x20,0x73,0x74,0x69,0x6c,0x6c,0x20,0x68,0x61,
|
||||
0x76,0x69,0x6e,0x67,0x20,0x61,0x20,0x66,0x75,0x6c,0x6c,0x20,0x73,0x63,0x61,0x6c,
|
||||
0x65,0x20,0x54,0x43,0x50,0x2e,0x20,0x54,0x68,0x69,0x73,0x0d,0x0a,0x09,0x20,0x20,
|
||||
0x20,0x20,0x6d,0x61,0x6b,0x65,0x73,0x20,0x6c,0x77,0x49,0x50,0x20,0x73,0x75,0x69,
|
||||
0x74,0x61,0x62,0x6c,0x65,0x20,0x66,0x6f,0x72,0x20,0x75,0x73,0x65,0x20,0x69,0x6e,
|
||||
0x20,0x65,0x6d,0x62,0x65,0x64,0x64,0x65,0x64,0x20,0x73,0x79,0x73,0x74,0x65,0x6d,
|
||||
0x73,0x20,0x77,0x69,0x74,0x68,0x20,0x74,0x65,0x6e,0x73,0x0d,0x0a,0x09,0x20,0x20,
|
||||
0x20,0x20,0x6f,0x66,0x20,0x6b,0x69,0x6c,0x6f,0x62,0x79,0x74,0x65,0x73,0x20,0x6f,
|
||||
0x66,0x20,0x66,0x72,0x65,0x65,0x20,0x52,0x41,0x4d,0x20,0x61,0x6e,0x64,0x20,0x72,
|
||||
0x6f,0x6f,0x6d,0x20,0x66,0x6f,0x72,0x20,0x61,0x72,0x6f,0x75,0x6e,0x64,0x20,0x34,
|
||||
0x30,0x20,0x6b,0x69,0x6c,0x6f,0x62,0x79,0x74,0x65,0x73,0x0d,0x0a,0x09,0x20,0x20,
|
||||
0x20,0x20,0x6f,0x66,0x20,0x63,0x6f,0x64,0x65,0x20,0x52,0x4f,0x4d,0x2e,0x0d,0x0a,
|
||||
0x09,0x20,0x20,0x3c,0x2f,0x70,0x3e,0x0d,0x0a,0x09,0x20,0x20,0x3c,0x70,0x3e,0x0d,
|
||||
0x0a,0x09,0x20,0x20,0x20,0x20,0x4d,0x6f,0x72,0x65,0x20,0x69,0x6e,0x66,0x6f,0x72,
|
||||
0x6d,0x61,0x74,0x69,0x6f,0x6e,0x20,0x61,0x62,0x6f,0x75,0x74,0x20,0x6c,0x77,0x49,
|
||||
0x50,0x20,0x63,0x61,0x6e,0x20,0x62,0x65,0x20,0x66,0x6f,0x75,0x6e,0x64,0x20,0x61,
|
||||
0x74,0x20,0x74,0x68,0x65,0x20,0x6c,0x77,0x49,0x50,0x0d,0x0a,0x09,0x20,0x20,0x20,
|
||||
0x20,0x68,0x6f,0x6d,0x65,0x70,0x61,0x67,0x65,0x20,0x61,0x74,0x20,0x3c,0x61,0x0d,
|
||||
0x0a,0x09,0x20,0x20,0x20,0x20,0x68,0x72,0x65,0x66,0x3d,0x22,0x68,0x74,0x74,0x70,
|
||||
0x3a,0x2f,0x2f,0x73,0x61,0x76,0x61,0x6e,0x6e,0x61,0x68,0x2e,0x6e,0x6f,0x6e,0x67,
|
||||
0x6e,0x75,0x2e,0x6f,0x72,0x67,0x2f,0x70,0x72,0x6f,0x6a,0x65,0x63,0x74,0x73,0x2f,
|
||||
0x6c,0x77,0x69,0x70,0x2f,0x22,0x3e,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x73,0x61,
|
||||
0x76,0x61,0x6e,0x6e,0x61,0x68,0x2e,0x6e,0x6f,0x6e,0x67,0x6e,0x75,0x2e,0x6f,0x72,
|
||||
0x67,0x2f,0x70,0x72,0x6f,0x6a,0x65,0x63,0x74,0x73,0x2f,0x6c,0x77,0x69,0x70,0x2f,
|
||||
0x3c,0x2f,0x61,0x3e,0x0d,0x0a,0x09,0x20,0x20,0x20,0x20,0x6f,0x72,0x20,0x61,0x74,
|
||||
0x20,0x74,0x68,0x65,0x20,0x6c,0x77,0x49,0x50,0x20,0x77,0x69,0x6b,0x69,0x20,0x61,
|
||||
0x74,0x20,0x3c,0x61,0x0d,0x0a,0x09,0x20,0x20,0x20,0x20,0x68,0x72,0x65,0x66,0x3d,
|
||||
0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x6c,0x77,0x69,0x70,0x2e,0x77,0x69,0x6b,
|
||||
0x69,0x61,0x2e,0x63,0x6f,0x6d,0x2f,0x22,0x3e,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,
|
||||
0x6c,0x77,0x69,0x70,0x2e,0x77,0x69,0x6b,0x69,0x61,0x2e,0x63,0x6f,0x6d,0x2f,0x3c,
|
||||
0x2f,0x61,0x3e,0x2e,0x0d,0x0a,0x09,0x20,0x20,0x3c,0x2f,0x70,0x3e,0x0d,0x0a,0x09,
|
||||
0x3c,0x2f,0x74,0x64,0x3e,0x3c,0x74,0x64,0x3e,0x0d,0x0a,0x09,0x20,0x20,0x26,0x6e,
|
||||
0x62,0x73,0x70,0x3b,0x0d,0x0a,0x09,0x3c,0x2f,0x74,0x64,0x3e,0x3c,0x2f,0x74,0x72,
|
||||
0x3e,0x0d,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x2f,0x74,0x61,0x62,0x6c,0x65,
|
||||
0x3e,0x0d,0x0a,0x3c,0x2f,0x62,0x6f,0x64,0x79,0x3e,0x0d,0x0a,0x3c,0x2f,0x68,0x74,
|
||||
0x6d,0x6c,0x3e,0x0d,0x0a,0x0d,0x0a,};
|
||||
|
||||
|
||||
|
||||
const struct fsdata_file file__img_sics_gif[] = { {
|
||||
file_NULL,
|
||||
data__img_sics_gif,
|
||||
data__img_sics_gif + 16,
|
||||
sizeof(data__img_sics_gif) - 16,
|
||||
1,
|
||||
}};
|
||||
|
||||
const struct fsdata_file file__404_html[] = { {
|
||||
file__img_sics_gif,
|
||||
data__404_html,
|
||||
data__404_html + 12,
|
||||
sizeof(data__404_html) - 12,
|
||||
1,
|
||||
}};
|
||||
|
||||
const struct fsdata_file file__index_html[] = { {
|
||||
file__404_html,
|
||||
data__index_html,
|
||||
data__index_html + 12,
|
||||
sizeof(data__index_html) - 12,
|
||||
1,
|
||||
}};
|
||||
|
||||
#define FS_ROOT file__index_html
|
||||
#define FS_NUMFILES 3
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,114 +0,0 @@
|
||||
#ifndef LWIP_HTTPD_STRUCTS_H
|
||||
#define LWIP_HTTPD_STRUCTS_H
|
||||
|
||||
#include "lwip/apps/httpd.h"
|
||||
|
||||
#if LWIP_HTTPD_DYNAMIC_HEADERS
|
||||
/** This struct is used for a list of HTTP header strings for various
|
||||
* filename extensions. */
|
||||
typedef struct
|
||||
{
|
||||
const char *extension;
|
||||
const char *content_type;
|
||||
} tHTTPHeader;
|
||||
|
||||
/** A list of strings used in HTTP headers (see RFC 1945 HTTP/1.0 and
|
||||
* RFC 2616 HTTP/1.1 for header field definitions) */
|
||||
static const char * const g_psHTTPHeaderStrings[] =
|
||||
{
|
||||
"HTTP/1.0 200 OK\r\n",
|
||||
"HTTP/1.0 404 File not found\r\n",
|
||||
"HTTP/1.0 400 Bad Request\r\n",
|
||||
"HTTP/1.0 501 Not Implemented\r\n",
|
||||
"HTTP/1.1 200 OK\r\n",
|
||||
"HTTP/1.1 404 File not found\r\n",
|
||||
"HTTP/1.1 400 Bad Request\r\n",
|
||||
"HTTP/1.1 501 Not Implemented\r\n",
|
||||
"Content-Length: ",
|
||||
"Connection: Close\r\n",
|
||||
"Connection: keep-alive\r\n",
|
||||
"Connection: keep-alive\r\nContent-Length: ",
|
||||
"Server: "HTTPD_SERVER_AGENT"\r\n",
|
||||
"\r\n<html><body><h2>404: The requested file cannot be found.</h2></body></html>\r\n"
|
||||
#if LWIP_HTTPD_SUPPORT_11_KEEPALIVE
|
||||
,"Connection: keep-alive\r\nContent-Length: 77\r\n\r\n<html><body><h2>404: The requested file cannot be found.</h2></body></html>\r\n"
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Indexes into the g_psHTTPHeaderStrings array */
|
||||
#define HTTP_HDR_OK 0 /* 200 OK */
|
||||
#define HTTP_HDR_NOT_FOUND 1 /* 404 File not found */
|
||||
#define HTTP_HDR_BAD_REQUEST 2 /* 400 Bad request */
|
||||
#define HTTP_HDR_NOT_IMPL 3 /* 501 Not Implemented */
|
||||
#define HTTP_HDR_OK_11 4 /* 200 OK */
|
||||
#define HTTP_HDR_NOT_FOUND_11 5 /* 404 File not found */
|
||||
#define HTTP_HDR_BAD_REQUEST_11 6 /* 400 Bad request */
|
||||
#define HTTP_HDR_NOT_IMPL_11 7 /* 501 Not Implemented */
|
||||
#define HTTP_HDR_CONTENT_LENGTH 8 /* Content-Length: (HTTP 1.0)*/
|
||||
#define HTTP_HDR_CONN_CLOSE 9 /* Connection: Close (HTTP 1.1) */
|
||||
#define HTTP_HDR_CONN_KEEPALIVE 10 /* Connection: keep-alive (HTTP 1.1) */
|
||||
#define HTTP_HDR_KEEPALIVE_LEN 11 /* Connection: keep-alive + Content-Length: (HTTP 1.1)*/
|
||||
#define HTTP_HDR_SERVER 12 /* Server: HTTPD_SERVER_AGENT */
|
||||
#define DEFAULT_404_HTML 13 /* default 404 body */
|
||||
#if LWIP_HTTPD_SUPPORT_11_KEEPALIVE
|
||||
#define DEFAULT_404_HTML_PERSISTENT 14 /* default 404 body, but including Connection: keep-alive */
|
||||
#endif
|
||||
|
||||
|
||||
#define HTTP_HDR_HTML "Content-type: text/html\r\n\r\n"
|
||||
#define HTTP_HDR_SSI "Content-type: text/html\r\nExpires: Fri, 10 Apr 2008 14:00:00 GMT\r\nPragma: no-cache\r\n\r\n"
|
||||
#define HTTP_HDR_GIF "Content-type: image/gif\r\n\r\n"
|
||||
#define HTTP_HDR_PNG "Content-type: image/png\r\n\r\n"
|
||||
#define HTTP_HDR_JPG "Content-type: image/jpeg\r\n\r\n"
|
||||
#define HTTP_HDR_BMP "Content-type: image/bmp\r\n\r\n"
|
||||
#define HTTP_HDR_ICO "Content-type: image/x-icon\r\n\r\n"
|
||||
#define HTTP_HDR_APP "Content-type: application/octet-stream\r\n\r\n"
|
||||
#define HTTP_HDR_JS "Content-type: application/javascript\r\n\r\n"
|
||||
#define HTTP_HDR_RA "Content-type: application/javascript\r\n\r\n"
|
||||
#define HTTP_HDR_CSS "Content-type: text/css\r\n\r\n"
|
||||
#define HTTP_HDR_SWF "Content-type: application/x-shockwave-flash\r\n\r\n"
|
||||
#define HTTP_HDR_XML "Content-type: text/xml\r\n\r\n"
|
||||
#define HTTP_HDR_PDF "Content-type: application/pdf\r\n\r\n"
|
||||
#define HTTP_HDR_JSON "Content-type: application/json\r\n\r\n"
|
||||
|
||||
#define HTTP_HDR_DEFAULT_TYPE "Content-type: text/plain\r\n\r\n"
|
||||
|
||||
/** A list of extension-to-HTTP header strings (see outdated RFC 1700 MEDIA TYPES
|
||||
* and http://www.iana.org/assignments/media-types for registered content types
|
||||
* and subtypes) */
|
||||
static const tHTTPHeader g_psHTTPHeaders[] =
|
||||
{
|
||||
{ "html", HTTP_HDR_HTML},
|
||||
{ "htm", HTTP_HDR_HTML},
|
||||
{ "shtml",HTTP_HDR_SSI},
|
||||
{ "shtm", HTTP_HDR_SSI},
|
||||
{ "ssi", HTTP_HDR_SSI},
|
||||
{ "gif", HTTP_HDR_GIF},
|
||||
{ "png", HTTP_HDR_PNG},
|
||||
{ "jpg", HTTP_HDR_JPG},
|
||||
{ "bmp", HTTP_HDR_BMP},
|
||||
{ "ico", HTTP_HDR_ICO},
|
||||
{ "class",HTTP_HDR_APP},
|
||||
{ "cls", HTTP_HDR_APP},
|
||||
{ "js", HTTP_HDR_JS},
|
||||
{ "ram", HTTP_HDR_RA},
|
||||
{ "css", HTTP_HDR_CSS},
|
||||
{ "swf", HTTP_HDR_SWF},
|
||||
{ "xml", HTTP_HDR_XML},
|
||||
{ "xsl", HTTP_HDR_XML},
|
||||
{ "pdf", HTTP_HDR_PDF},
|
||||
{ "json", HTTP_HDR_JSON}
|
||||
};
|
||||
|
||||
#define NUM_HTTP_HEADERS (sizeof(g_psHTTPHeaders) / sizeof(tHTTPHeader))
|
||||
|
||||
#endif /* LWIP_HTTPD_DYNAMIC_HEADERS */
|
||||
|
||||
#if LWIP_HTTPD_SSI
|
||||
static const char * const g_pcSSIExtensions[] = {
|
||||
".shtml", ".shtm", ".ssi", ".xml"
|
||||
};
|
||||
#define NUM_SHTML_EXTENSIONS (sizeof(g_pcSSIExtensions) / sizeof(const char *))
|
||||
#endif /* LWIP_HTTPD_SSI */
|
||||
|
||||
#endif /* LWIP_HTTPD_STRUCTS_H */
|
||||
@@ -1,97 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
open(OUTPUT, "> fsdata.c");
|
||||
|
||||
chdir("fs");
|
||||
open(FILES, "find . -type f |");
|
||||
|
||||
while($file = <FILES>) {
|
||||
|
||||
# Do not include files in CVS directories nor backup files.
|
||||
if($file =~ /(CVS|~)/) {
|
||||
next;
|
||||
}
|
||||
|
||||
chop($file);
|
||||
|
||||
open(HEADER, "> /tmp/header") || die $!;
|
||||
if($file =~ /404/) {
|
||||
print(HEADER "HTTP/1.0 404 File not found\r\n");
|
||||
} else {
|
||||
print(HEADER "HTTP/1.0 200 OK\r\n");
|
||||
}
|
||||
print(HEADER "Server: lwIP/pre-0.6 (http://www.sics.se/~adam/lwip/)\r\n");
|
||||
if($file =~ /\.html$/) {
|
||||
print(HEADER "Content-type: text/html\r\n");
|
||||
} elsif($file =~ /\.gif$/) {
|
||||
print(HEADER "Content-type: image/gif\r\n");
|
||||
} elsif($file =~ /\.png$/) {
|
||||
print(HEADER "Content-type: image/png\r\n");
|
||||
} elsif($file =~ /\.jpg$/) {
|
||||
print(HEADER "Content-type: image/jpeg\r\n");
|
||||
} elsif($file =~ /\.class$/) {
|
||||
print(HEADER "Content-type: application/octet-stream\r\n");
|
||||
} elsif($file =~ /\.ram$/) {
|
||||
print(HEADER "Content-type: audio/x-pn-realaudio\r\n");
|
||||
} else {
|
||||
print(HEADER "Content-type: text/plain\r\n");
|
||||
}
|
||||
print(HEADER "\r\n");
|
||||
close(HEADER);
|
||||
|
||||
unless($file =~ /\.plain$/ || $file =~ /cgi/) {
|
||||
system("cat /tmp/header $file > /tmp/file");
|
||||
} else {
|
||||
system("cp $file /tmp/file");
|
||||
}
|
||||
|
||||
open(FILE, "/tmp/file");
|
||||
unlink("/tmp/file");
|
||||
unlink("/tmp/header");
|
||||
|
||||
$file =~ s/\.//;
|
||||
$fvar = $file;
|
||||
$fvar =~ s-/-_-g;
|
||||
$fvar =~ s-\.-_-g;
|
||||
print(OUTPUT "static const unsigned char data".$fvar."[] = {\n");
|
||||
print(OUTPUT "\t/* $file */\n\t");
|
||||
for($j = 0; $j < length($file); $j++) {
|
||||
printf(OUTPUT "%#02x, ", unpack("C", substr($file, $j, 1)));
|
||||
}
|
||||
printf(OUTPUT "0,\n");
|
||||
|
||||
|
||||
$i = 0;
|
||||
while(read(FILE, $data, 1)) {
|
||||
if($i == 0) {
|
||||
print(OUTPUT "\t");
|
||||
}
|
||||
printf(OUTPUT "%#02x, ", unpack("C", $data));
|
||||
$i++;
|
||||
if($i == 10) {
|
||||
print(OUTPUT "\n");
|
||||
$i = 0;
|
||||
}
|
||||
}
|
||||
print(OUTPUT "};\n\n");
|
||||
close(FILE);
|
||||
push(@fvars, $fvar);
|
||||
push(@files, $file);
|
||||
}
|
||||
|
||||
for($i = 0; $i < @fvars; $i++) {
|
||||
$file = $files[$i];
|
||||
$fvar = $fvars[$i];
|
||||
|
||||
if($i == 0) {
|
||||
$prevfile = "NULL";
|
||||
} else {
|
||||
$prevfile = "file" . $fvars[$i - 1];
|
||||
}
|
||||
print(OUTPUT "const struct fsdata_file file".$fvar."[] = {{$prevfile, data$fvar, ");
|
||||
print(OUTPUT "data$fvar + ". (length($file) + 1) .", ");
|
||||
print(OUTPUT "sizeof(data$fvar) - ". (length($file) + 1) ."}};\n\n");
|
||||
}
|
||||
|
||||
print(OUTPUT "#define FS_ROOT file$fvars[$i - 1]\n\n");
|
||||
print(OUTPUT "#define FS_NUMFILES $i\n");
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,13 +0,0 @@
|
||||
This directory contains a script ('makefsdata') to create C code suitable for
|
||||
httpd for given html pages (or other files) in a directory.
|
||||
|
||||
There is also a plain C console application doing the same and extended a bit.
|
||||
|
||||
Usage: htmlgen [targetdir] [-s] [-i]s
|
||||
targetdir: relative or absolute path to files to convert
|
||||
switch -s: toggle processing of subdirectories (default is on)
|
||||
switch -e: exclude HTTP header from file (header is created at runtime, default is on)
|
||||
switch -11: include HTTP 1.1 header (1.0 is default)
|
||||
|
||||
if targetdir not specified, makefsdata will attempt to
|
||||
process files in subdirectory 'fs'.
|
||||
@@ -1,650 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
* LWIP iperf server implementation
|
||||
*
|
||||
* This is simple "Iperf" server to check your bandwith using Iperf on a PC as client.
|
||||
* It is currently a minimal implementation providing an IPv4 TCP server only.
|
||||
*
|
||||
* @todo:
|
||||
* - implement UDP mode
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2014 Simon Goldschmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Simon Goldschmidt
|
||||
*/
|
||||
|
||||
#include "lwip/apps/lwiperf.h"
|
||||
|
||||
#include "lwip/tcp.h"
|
||||
#include "lwip/sys.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/* Currently, only TCP-over-IPv4 is implemented (does iperf support IPv6 anyway?) */
|
||||
#if LWIP_IPV4 && LWIP_TCP
|
||||
|
||||
/** Specify the idle timeout (in seconds) after that the test fails */
|
||||
#ifndef LWIPERF_TCP_MAX_IDLE_SEC
|
||||
#define LWIPERF_TCP_MAX_IDLE_SEC 10U
|
||||
#endif
|
||||
#if LWIPERF_TCP_MAX_IDLE_SEC > 255
|
||||
#error LWIPERF_TCP_MAX_IDLE_SEC must fit into an u8_t
|
||||
#endif
|
||||
|
||||
/* File internal memory allocation (struct lwiperf_*): this defaults to
|
||||
the heap */
|
||||
#ifndef LWIPERF_ALLOC
|
||||
#define LWIPERF_ALLOC(type) mem_malloc(sizeof(type))
|
||||
#define LWIPERF_FREE(type, item) mem_free(item)
|
||||
#endif
|
||||
|
||||
/** If this is 1, check that received data has the correct format */
|
||||
#ifndef LWIPERF_CHECK_RX_DATA
|
||||
#define LWIPERF_CHECK_RX_DATA 0
|
||||
#endif
|
||||
|
||||
/** This is the Iperf settings struct sent from the client */
|
||||
typedef struct _lwiperf_settings {
|
||||
#define LWIPERF_FLAGS_ANSWER_TEST 0x80000000
|
||||
#define LWIPERF_FLAGS_ANSWER_NOW 0x00000001
|
||||
u32_t flags;
|
||||
u32_t num_threads; /* unused for now */
|
||||
u32_t remote_port;
|
||||
u32_t buffer_len; /* unused for now */
|
||||
u32_t win_band; /* TCP window / UDP rate: unused for now */
|
||||
u32_t amount; /* pos. value: bytes?; neg. values: time (unit is 10ms: 1/100 second) */
|
||||
} lwiperf_settings_t;
|
||||
|
||||
/** Basic connection handle */
|
||||
struct _lwiperf_state_base;
|
||||
typedef struct _lwiperf_state_base lwiperf_state_base_t;
|
||||
struct _lwiperf_state_base {
|
||||
/* 1=tcp, 0=udp */
|
||||
u8_t tcp;
|
||||
/* 1=server, 0=client */
|
||||
u8_t server;
|
||||
lwiperf_state_base_t* next;
|
||||
lwiperf_state_base_t* related_server_state;
|
||||
};
|
||||
|
||||
/** Connection handle for a TCP iperf session */
|
||||
typedef struct _lwiperf_state_tcp {
|
||||
lwiperf_state_base_t base;
|
||||
struct tcp_pcb* server_pcb;
|
||||
struct tcp_pcb* conn_pcb;
|
||||
u32_t time_started;
|
||||
lwiperf_report_fn report_fn;
|
||||
void* report_arg;
|
||||
u8_t poll_count;
|
||||
u8_t next_num;
|
||||
u32_t bytes_transferred;
|
||||
lwiperf_settings_t settings;
|
||||
u8_t have_settings_buf;
|
||||
} lwiperf_state_tcp_t;
|
||||
|
||||
/** List of active iperf sessions */
|
||||
static lwiperf_state_base_t* lwiperf_all_connections;
|
||||
/** A const buffer to send from: we want to measure sending, not copying! */
|
||||
static const u8_t lwiperf_txbuf_const[1600] = {
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
'0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9','0','1','2','3','4','5','6','7','8','9',
|
||||
};
|
||||
|
||||
static err_t lwiperf_tcp_poll(void *arg, struct tcp_pcb *tpcb);
|
||||
static void lwiperf_tcp_err(void *arg, err_t err);
|
||||
|
||||
/** Add an iperf session to the 'active' list */
|
||||
static void
|
||||
lwiperf_list_add(lwiperf_state_base_t* item)
|
||||
{
|
||||
if (lwiperf_all_connections == NULL) {
|
||||
lwiperf_all_connections = item;
|
||||
} else {
|
||||
item = lwiperf_all_connections;
|
||||
}
|
||||
}
|
||||
|
||||
/** Remove an iperf session from the 'active' list */
|
||||
static void
|
||||
lwiperf_list_remove(lwiperf_state_base_t* item)
|
||||
{
|
||||
lwiperf_state_base_t* prev = NULL;
|
||||
lwiperf_state_base_t* iter;
|
||||
for (iter = lwiperf_all_connections; iter != NULL; prev = iter, iter = iter->next) {
|
||||
if (iter == item) {
|
||||
if (prev == NULL) {
|
||||
lwiperf_all_connections = iter->next;
|
||||
} else {
|
||||
prev->next = item;
|
||||
}
|
||||
/* @debug: ensure this item is listed only once */
|
||||
for (iter = iter->next; iter != NULL; iter = iter->next) {
|
||||
LWIP_ASSERT("duplicate entry", iter != item);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Call the report function of an iperf tcp session */
|
||||
static void
|
||||
lwip_tcp_conn_report(lwiperf_state_tcp_t* conn, enum lwiperf_report_type report_type)
|
||||
{
|
||||
if ((conn != NULL) && (conn->report_fn != NULL)) {
|
||||
u32_t now, duration_ms, bandwidth_kbitpsec;
|
||||
now = sys_now();
|
||||
duration_ms = now - conn->time_started;
|
||||
if (duration_ms == 0) {
|
||||
bandwidth_kbitpsec = 0;
|
||||
} else {
|
||||
bandwidth_kbitpsec = (conn->bytes_transferred / duration_ms) * 8U;
|
||||
}
|
||||
conn->report_fn(conn->report_arg, report_type,
|
||||
&conn->conn_pcb->local_ip, conn->conn_pcb->local_port,
|
||||
&conn->conn_pcb->remote_ip, conn->conn_pcb->remote_port,
|
||||
conn->bytes_transferred, duration_ms, bandwidth_kbitpsec);
|
||||
}
|
||||
}
|
||||
|
||||
/** Close an iperf tcp session */
|
||||
static void
|
||||
lwiperf_tcp_close(lwiperf_state_tcp_t* conn, enum lwiperf_report_type report_type)
|
||||
{
|
||||
err_t err;
|
||||
|
||||
lwip_tcp_conn_report(conn, report_type);
|
||||
lwiperf_list_remove(&conn->base);
|
||||
if (conn->conn_pcb != NULL) {
|
||||
tcp_arg(conn->conn_pcb, NULL);
|
||||
tcp_poll(conn->conn_pcb, NULL, 0);
|
||||
tcp_sent(conn->conn_pcb, NULL);
|
||||
tcp_recv(conn->conn_pcb, NULL);
|
||||
tcp_err(conn->conn_pcb, NULL);
|
||||
err = tcp_close(conn->conn_pcb);
|
||||
if (err != ERR_OK) {
|
||||
/* don't want to wait for free memory here... */
|
||||
tcp_abort(conn->conn_pcb);
|
||||
}
|
||||
} else {
|
||||
/* no conn pcb, this is the server pcb */
|
||||
err = tcp_close(conn->server_pcb);
|
||||
LWIP_ASSERT("error", err != ERR_OK);
|
||||
}
|
||||
LWIPERF_FREE(lwiperf_state_tcp_t, conn);
|
||||
}
|
||||
|
||||
/** Try to send more data on an iperf tcp session */
|
||||
static err_t
|
||||
lwiperf_tcp_client_send_more(lwiperf_state_tcp_t* conn)
|
||||
{
|
||||
int send_more;
|
||||
err_t err;
|
||||
u16_t txlen;
|
||||
u16_t txlen_max;
|
||||
void* txptr;
|
||||
u8_t apiflags;
|
||||
|
||||
LWIP_ASSERT("conn invalid", (conn != NULL) && conn->base.tcp && (conn->base.server == 0));
|
||||
|
||||
do {
|
||||
send_more = 0;
|
||||
if (conn->settings.amount & PP_HTONL(0x80000000)) {
|
||||
/* this session is time-limited */
|
||||
u32_t now = sys_now();
|
||||
u32_t diff_ms = now - conn->time_started;
|
||||
u32_t time = (u32_t)-(s32_t)htonl(conn->settings.amount);
|
||||
u32_t time_ms = time * 10;
|
||||
if (diff_ms >= time_ms) {
|
||||
/* time specified by the client is over -> close the connection */
|
||||
lwiperf_tcp_close(conn, LWIPERF_TCP_DONE_CLIENT);
|
||||
return ERR_OK;
|
||||
}
|
||||
} else {
|
||||
/* this session is byte-limited */
|
||||
u32_t amount_bytes = htonl(conn->settings.amount);
|
||||
/* @todo: this can send up to 1*MSS more than requested... */
|
||||
if (amount_bytes >= conn->bytes_transferred) {
|
||||
/* all requested bytes transferred -> close the connection */
|
||||
lwiperf_tcp_close(conn, LWIPERF_TCP_DONE_CLIENT);
|
||||
return ERR_OK;
|
||||
}
|
||||
}
|
||||
|
||||
if (conn->bytes_transferred < 24) {
|
||||
/* transmit the settings a first time */
|
||||
txptr = &((u8_t*)&conn->settings)[conn->bytes_transferred];
|
||||
txlen_max = (u16_t)(24 - conn->bytes_transferred);
|
||||
apiflags = TCP_WRITE_FLAG_COPY;
|
||||
} else if (conn->bytes_transferred < 48) {
|
||||
/* transmit the settings a second time */
|
||||
txptr = &((u8_t*)&conn->settings)[conn->bytes_transferred - 24];
|
||||
txlen_max = (u16_t)(48 - conn->bytes_transferred);
|
||||
apiflags = TCP_WRITE_FLAG_COPY | TCP_WRITE_FLAG_MORE;
|
||||
send_more = 1;
|
||||
} else {
|
||||
/* transmit data */
|
||||
/* @todo: every x bytes, transmit the settings again */
|
||||
txptr = (void*)(size_t)&lwiperf_txbuf_const[conn->bytes_transferred % 10];
|
||||
txlen_max = TCP_MSS;
|
||||
if (conn->bytes_transferred == 48) { /* @todo: fix this for intermediate settings, too */
|
||||
txlen_max = TCP_MSS - 24;
|
||||
}
|
||||
apiflags = 0; /* no copying needed */
|
||||
send_more = 1;
|
||||
}
|
||||
txlen = txlen_max;
|
||||
do {
|
||||
err = tcp_write(conn->conn_pcb, txptr, txlen, apiflags);
|
||||
if (err == ERR_MEM) {
|
||||
txlen /= 2;
|
||||
}
|
||||
} while ((err == ERR_MEM) && (txlen >= (TCP_MSS/2)));
|
||||
|
||||
if (err == ERR_OK) {
|
||||
conn->bytes_transferred += txlen;
|
||||
} else {
|
||||
send_more = 0;
|
||||
}
|
||||
} while(send_more);
|
||||
|
||||
tcp_output(conn->conn_pcb);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/** TCP sent callback, try to send more data */
|
||||
static err_t
|
||||
lwiperf_tcp_client_sent(void *arg, struct tcp_pcb *tpcb, u16_t len)
|
||||
{
|
||||
lwiperf_state_tcp_t* conn = (lwiperf_state_tcp_t*)arg;
|
||||
/* @todo: check 'len' (e.g. to time ACK of all data)? for now, we just send more... */
|
||||
LWIP_ASSERT("invalid conn", conn->conn_pcb == tpcb);
|
||||
LWIP_UNUSED_ARG(tpcb);
|
||||
LWIP_UNUSED_ARG(len);
|
||||
|
||||
conn->poll_count = 0;
|
||||
|
||||
return lwiperf_tcp_client_send_more(conn);
|
||||
}
|
||||
|
||||
/** TCP connected callback (active connection), send data now */
|
||||
static err_t
|
||||
lwiperf_tcp_client_connected(void *arg, struct tcp_pcb *tpcb, err_t err)
|
||||
{
|
||||
lwiperf_state_tcp_t* conn = (lwiperf_state_tcp_t*)arg;
|
||||
LWIP_ASSERT("invalid conn", conn->conn_pcb == tpcb);
|
||||
LWIP_UNUSED_ARG(tpcb);
|
||||
if (err != ERR_OK) {
|
||||
lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_REMOTE);
|
||||
return ERR_OK;
|
||||
}
|
||||
conn->poll_count = 0;
|
||||
conn->time_started = sys_now();
|
||||
return lwiperf_tcp_client_send_more(conn);
|
||||
}
|
||||
|
||||
/** Start TCP connection back to the client (either parallel or after the
|
||||
* receive test has finished.
|
||||
*/
|
||||
static err_t
|
||||
lwiperf_tx_start(lwiperf_state_tcp_t* conn)
|
||||
{
|
||||
err_t err;
|
||||
lwiperf_state_tcp_t* client_conn;
|
||||
struct tcp_pcb* newpcb;
|
||||
ip_addr_t remote_addr;
|
||||
u16_t remote_port;
|
||||
|
||||
client_conn = (lwiperf_state_tcp_t*)LWIPERF_ALLOC(lwiperf_state_tcp_t);
|
||||
if (client_conn == NULL) {
|
||||
return ERR_MEM;
|
||||
}
|
||||
newpcb = tcp_new();
|
||||
if (newpcb == NULL) {
|
||||
LWIPERF_FREE(lwiperf_state_tcp_t, client_conn);
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
memcpy(client_conn, conn, sizeof(lwiperf_state_tcp_t));
|
||||
client_conn->base.server = 0;
|
||||
client_conn->server_pcb = NULL;
|
||||
client_conn->conn_pcb = newpcb;
|
||||
client_conn->time_started = sys_now(); /* TODO: set this again on 'connected' */
|
||||
client_conn->poll_count = 0;
|
||||
client_conn->next_num = 4; /* initial nr is '4' since the header has 24 byte */
|
||||
client_conn->bytes_transferred = 0;
|
||||
client_conn->settings.flags = 0; /* prevent the remote side starting back as client again */
|
||||
|
||||
tcp_arg(newpcb, client_conn);
|
||||
tcp_sent(newpcb, lwiperf_tcp_client_sent);
|
||||
tcp_poll(newpcb, lwiperf_tcp_poll, 2U);
|
||||
tcp_err(newpcb, lwiperf_tcp_err);
|
||||
|
||||
ip_addr_copy(remote_addr, conn->conn_pcb->remote_ip);
|
||||
remote_port = (u16_t)htonl(client_conn->settings.remote_port);
|
||||
|
||||
err = tcp_connect(newpcb, &remote_addr, remote_port, lwiperf_tcp_client_connected);
|
||||
if (err != ERR_OK) {
|
||||
lwiperf_tcp_close(client_conn, LWIPERF_TCP_ABORTED_LOCAL);
|
||||
return err;
|
||||
}
|
||||
lwiperf_list_add(&client_conn->base);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/** Receive data on an iperf tcp session */
|
||||
static err_t
|
||||
lwiperf_tcp_recv(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err)
|
||||
{
|
||||
u16_t tot_len;
|
||||
u32_t packet_idx;
|
||||
struct pbuf* q;
|
||||
lwiperf_state_tcp_t* conn = (lwiperf_state_tcp_t*)arg;
|
||||
|
||||
LWIP_ASSERT("pcb mismatch", conn->conn_pcb == tpcb);
|
||||
LWIP_UNUSED_ARG(tpcb);
|
||||
|
||||
if (err != ERR_OK) {
|
||||
lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_REMOTE);
|
||||
return ERR_OK;
|
||||
}
|
||||
if (p == NULL) {
|
||||
/* connection closed -> test done */
|
||||
if ((conn->settings.flags & PP_HTONL(LWIPERF_FLAGS_ANSWER_TEST|LWIPERF_FLAGS_ANSWER_NOW)) ==
|
||||
PP_HTONL(LWIPERF_FLAGS_ANSWER_TEST)) {
|
||||
/* client requested transmission after end of test */
|
||||
lwiperf_tx_start(conn);
|
||||
}
|
||||
lwiperf_tcp_close(conn, LWIPERF_TCP_DONE_SERVER);
|
||||
return ERR_OK;
|
||||
}
|
||||
tot_len = p->tot_len;
|
||||
|
||||
conn->poll_count = 0;
|
||||
|
||||
if ((!conn->have_settings_buf) || ((conn->bytes_transferred -24) % (1024*128) == 0)) {
|
||||
/* wait for 24-byte header */
|
||||
if (p->tot_len < sizeof(lwiperf_settings_t)) {
|
||||
lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_LOCAL_DATAERROR);
|
||||
pbuf_free(p);
|
||||
return ERR_VAL;
|
||||
}
|
||||
if (!conn->have_settings_buf) {
|
||||
if (pbuf_copy_partial(p, &conn->settings, sizeof(lwiperf_settings_t), 0) != sizeof(lwiperf_settings_t)) {
|
||||
lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_LOCAL);
|
||||
pbuf_free(p);
|
||||
return ERR_VAL;
|
||||
}
|
||||
conn->have_settings_buf = 1;
|
||||
if ((conn->settings.flags & PP_HTONL(LWIPERF_FLAGS_ANSWER_TEST|LWIPERF_FLAGS_ANSWER_NOW)) ==
|
||||
PP_HTONL(LWIPERF_FLAGS_ANSWER_TEST|LWIPERF_FLAGS_ANSWER_NOW)) {
|
||||
/* client requested parallel transmission test */
|
||||
err_t err2 = lwiperf_tx_start(conn);
|
||||
if (err2 != ERR_OK) {
|
||||
lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_LOCAL_TXERROR);
|
||||
pbuf_free(p);
|
||||
return err2;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (pbuf_memcmp(p, 0, &conn->settings, sizeof(lwiperf_settings_t)) != 0) {
|
||||
lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_LOCAL_DATAERROR);
|
||||
pbuf_free(p);
|
||||
return ERR_VAL;
|
||||
}
|
||||
}
|
||||
conn->bytes_transferred += sizeof(lwiperf_settings_t);
|
||||
if(conn->bytes_transferred <= 24) {
|
||||
conn->time_started = sys_now();
|
||||
tcp_recved(tpcb, p->tot_len);
|
||||
pbuf_free(p);
|
||||
return ERR_OK;
|
||||
}
|
||||
conn->next_num = 4; /* 24 bytes received... */
|
||||
err = pbuf_header(p, -24);
|
||||
LWIP_ASSERT("pbuf_header failed", err == ERR_OK);
|
||||
}
|
||||
|
||||
packet_idx = 0;
|
||||
for (q = p; q != NULL; q = q->next) {
|
||||
#if LWIPERF_CHECK_RX_DATA
|
||||
const u8_t* payload = (const u8_t*)q->payload;
|
||||
u16_t i;
|
||||
for (i = 0; i < q->len; i++) {
|
||||
u8_t val = payload[i];
|
||||
u8_t num = val - '0';
|
||||
if (num == conn->next_num) {
|
||||
conn->next_num++;
|
||||
if (conn->next_num == 10) {
|
||||
conn->next_num = 0;
|
||||
}
|
||||
} else {
|
||||
lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_LOCAL_DATAERROR);
|
||||
pbuf_free(p);
|
||||
return ERR_VAL;
|
||||
}
|
||||
}
|
||||
packet_idx += i;
|
||||
#else
|
||||
packet_idx += q->len;
|
||||
#endif
|
||||
}
|
||||
LWIP_ASSERT("count mismatch", packet_idx == p->tot_len);
|
||||
conn->bytes_transferred += packet_idx;
|
||||
tcp_recved(tpcb, tot_len);
|
||||
pbuf_free(p);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/** Error callback, iperf tcp session aborted */
|
||||
static void
|
||||
lwiperf_tcp_err(void *arg, err_t err)
|
||||
{
|
||||
lwiperf_state_tcp_t* conn = (lwiperf_state_tcp_t*)arg;
|
||||
LWIP_UNUSED_ARG(err);
|
||||
lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_REMOTE);
|
||||
}
|
||||
|
||||
/** TCP poll callback, try to send more data */
|
||||
static err_t
|
||||
lwiperf_tcp_poll(void *arg, struct tcp_pcb *tpcb)
|
||||
{
|
||||
lwiperf_state_tcp_t* conn = (lwiperf_state_tcp_t*)arg;
|
||||
LWIP_ASSERT("pcb mismatch", conn->conn_pcb == tpcb);
|
||||
LWIP_UNUSED_ARG(tpcb);
|
||||
if (++conn->poll_count >= LWIPERF_TCP_MAX_IDLE_SEC) {
|
||||
lwiperf_tcp_close(conn, LWIPERF_TCP_ABORTED_LOCAL);
|
||||
return ERR_OK; /* lwiperf_tcp_close frees conn */
|
||||
}
|
||||
|
||||
if (!conn->base.server) {
|
||||
lwiperf_tcp_client_send_more(conn);
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/** This is called when a new client connects for an iperf tcp session */
|
||||
static err_t
|
||||
lwiperf_tcp_accept(void *arg, struct tcp_pcb *newpcb, err_t err)
|
||||
{
|
||||
lwiperf_state_tcp_t *s, *conn;
|
||||
if ((err != ERR_OK) || (newpcb == NULL) || (arg == NULL)) {
|
||||
return ERR_VAL;
|
||||
}
|
||||
|
||||
s = (lwiperf_state_tcp_t*)arg;
|
||||
conn = (lwiperf_state_tcp_t*)LWIPERF_ALLOC(lwiperf_state_tcp_t);
|
||||
if (conn == NULL) {
|
||||
return ERR_MEM;
|
||||
}
|
||||
memset(conn, 0, sizeof(lwiperf_state_tcp_t));
|
||||
conn->base.tcp = 1;
|
||||
conn->base.server = 1;
|
||||
conn->base.related_server_state = &s->base;
|
||||
conn->server_pcb = s->server_pcb;
|
||||
conn->conn_pcb = newpcb;
|
||||
conn->time_started = sys_now();
|
||||
conn->report_fn = s->report_fn;
|
||||
conn->report_arg = s->report_arg;
|
||||
|
||||
/* setup the tcp rx connection */
|
||||
tcp_arg(newpcb, conn);
|
||||
tcp_recv(newpcb, lwiperf_tcp_recv);
|
||||
tcp_poll(newpcb, lwiperf_tcp_poll, 2U);
|
||||
tcp_err(conn->conn_pcb, lwiperf_tcp_err);
|
||||
|
||||
lwiperf_list_add(&conn->base);
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
/** Start a TCP iperf server on the default TCP port (5001) and listen for
|
||||
* incoming connections from iperf clients.
|
||||
*
|
||||
* @returns a connection handle that can be used to abort the server
|
||||
* by calling @ref lwiperf_abort()
|
||||
*/
|
||||
void*
|
||||
lwiperf_start_tcp_server_default(lwiperf_report_fn report_fn, void* report_arg)
|
||||
{
|
||||
return lwiperf_start_tcp_server(IP_ADDR_ANY, LWIPERF_TCP_PORT_DEFAULT,
|
||||
report_fn, report_arg);
|
||||
}
|
||||
|
||||
/** Start a TCP iperf server on a specific IP address and port and listen for
|
||||
* incoming connections from iperf clients.
|
||||
*
|
||||
* @returns a connection handle that can be used to abort the server
|
||||
* by calling @ref lwiperf_abort()
|
||||
*/
|
||||
void*
|
||||
lwiperf_start_tcp_server(const ip_addr_t* local_addr, u16_t local_port,
|
||||
lwiperf_report_fn report_fn, void* report_arg)
|
||||
{
|
||||
err_t err;
|
||||
struct tcp_pcb* pcb;
|
||||
lwiperf_state_tcp_t* s;
|
||||
|
||||
if(local_addr == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
s = (lwiperf_state_tcp_t*)LWIPERF_ALLOC(lwiperf_state_tcp_t);
|
||||
if (s == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
memset(s, 0, sizeof(lwiperf_state_tcp_t));
|
||||
s->base.tcp = 1;
|
||||
s->base.server = 1;
|
||||
s->report_fn = report_fn;
|
||||
s->report_arg = report_arg;
|
||||
|
||||
pcb = tcp_new();
|
||||
if (pcb != NULL) {
|
||||
err = tcp_bind(pcb, local_addr, local_port);
|
||||
if (err == ERR_OK) {
|
||||
s->server_pcb = tcp_listen_with_backlog(pcb, 1);
|
||||
}
|
||||
}
|
||||
if (s->server_pcb == NULL) {
|
||||
if (pcb != NULL) {
|
||||
tcp_close(pcb);
|
||||
}
|
||||
LWIPERF_FREE(lwiperf_state_tcp_t, s);
|
||||
return NULL;
|
||||
}
|
||||
pcb = NULL;
|
||||
|
||||
tcp_arg(s->server_pcb, s);
|
||||
tcp_accept(s->server_pcb, lwiperf_tcp_accept);
|
||||
|
||||
lwiperf_list_add(&s->base);
|
||||
return s;
|
||||
}
|
||||
|
||||
/** Abort an iperf session (handle returned by lwiperf_start_tcp_server*()) */
|
||||
void
|
||||
lwiperf_abort(void* lwiperf_session)
|
||||
{
|
||||
lwiperf_state_base_t* i, *dealloc, *last = NULL;
|
||||
|
||||
for (i = lwiperf_all_connections; i != NULL; ) {
|
||||
if ((i == lwiperf_session) || (i->related_server_state == lwiperf_session)) {
|
||||
dealloc = i;
|
||||
i = i->next;
|
||||
if (last != NULL) {
|
||||
last->next = i;
|
||||
}
|
||||
LWIPERF_FREE(lwiperf_state_tcp_t, dealloc); /* TODO: type? */
|
||||
} else {
|
||||
last = i;
|
||||
i = i->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* LWIP_IPV4 && LWIP_TCP */
|
||||
@@ -1,350 +0,0 @@
|
||||
/**
|
||||
* @file
|
||||
* NetBIOS name service responder
|
||||
*
|
||||
* This is an example implementation of a NetBIOS name server.
|
||||
* It responds to name queries for a configurable name.
|
||||
* Name resolving is not supported.
|
||||
*
|
||||
* Note that the device doesn't broadcast it's own name so can't
|
||||
* detect duplicate names!
|
||||
*/
|
||||
|
||||
/*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "lwip/apps/netbiosns.h"
|
||||
|
||||
#if LWIP_IPV4 && LWIP_UDP /* don't build if not configured for use in lwipopts.h */
|
||||
|
||||
#include "lwip/udp.h"
|
||||
#include "lwip/netif.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
/** default port number for "NetBIOS Name service */
|
||||
#define NETBIOS_PORT 137
|
||||
|
||||
/** size of a NetBIOS name */
|
||||
#define NETBIOS_NAME_LEN 16
|
||||
|
||||
/** The Time-To-Live for NetBIOS name responds (in seconds)
|
||||
* Default is 300000 seconds (3 days, 11 hours, 20 minutes) */
|
||||
#define NETBIOS_NAME_TTL 300000u
|
||||
|
||||
/** NetBIOS header flags */
|
||||
#define NETB_HFLAG_RESPONSE 0x8000U
|
||||
#define NETB_HFLAG_OPCODE 0x7800U
|
||||
#define NETB_HFLAG_OPCODE_NAME_QUERY 0x0000U
|
||||
#define NETB_HFLAG_AUTHORATIVE 0x0400U
|
||||
#define NETB_HFLAG_TRUNCATED 0x0200U
|
||||
#define NETB_HFLAG_RECURS_DESIRED 0x0100U
|
||||
#define NETB_HFLAG_RECURS_AVAILABLE 0x0080U
|
||||
#define NETB_HFLAG_BROADCAST 0x0010U
|
||||
#define NETB_HFLAG_REPLYCODE 0x0008U
|
||||
#define NETB_HFLAG_REPLYCODE_NOERROR 0x0000U
|
||||
|
||||
/** NetBIOS name flags */
|
||||
#define NETB_NFLAG_UNIQUE 0x8000U
|
||||
#define NETB_NFLAG_NODETYPE 0x6000U
|
||||
#define NETB_NFLAG_NODETYPE_HNODE 0x6000U
|
||||
#define NETB_NFLAG_NODETYPE_MNODE 0x4000U
|
||||
#define NETB_NFLAG_NODETYPE_PNODE 0x2000U
|
||||
#define NETB_NFLAG_NODETYPE_BNODE 0x0000U
|
||||
|
||||
/** NetBIOS message header */
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/bpstruct.h"
|
||||
#endif
|
||||
PACK_STRUCT_BEGIN
|
||||
struct netbios_hdr {
|
||||
PACK_STRUCT_FIELD(u16_t trans_id);
|
||||
PACK_STRUCT_FIELD(u16_t flags);
|
||||
PACK_STRUCT_FIELD(u16_t questions);
|
||||
PACK_STRUCT_FIELD(u16_t answerRRs);
|
||||
PACK_STRUCT_FIELD(u16_t authorityRRs);
|
||||
PACK_STRUCT_FIELD(u16_t additionalRRs);
|
||||
} PACK_STRUCT_STRUCT;
|
||||
PACK_STRUCT_END
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
|
||||
/** NetBIOS message name part */
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/bpstruct.h"
|
||||
#endif
|
||||
PACK_STRUCT_BEGIN
|
||||
struct netbios_name_hdr {
|
||||
PACK_STRUCT_FLD_8(u8_t nametype);
|
||||
PACK_STRUCT_FLD_8(u8_t encname[(NETBIOS_NAME_LEN*2)+1]);
|
||||
PACK_STRUCT_FIELD(u16_t type);
|
||||
PACK_STRUCT_FIELD(u16_t cls);
|
||||
PACK_STRUCT_FIELD(u32_t ttl);
|
||||
PACK_STRUCT_FIELD(u16_t datalen);
|
||||
PACK_STRUCT_FIELD(u16_t flags);
|
||||
PACK_STRUCT_FLD_S(ip4_addr_p_t addr);
|
||||
} PACK_STRUCT_STRUCT;
|
||||
PACK_STRUCT_END
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
|
||||
/** NetBIOS message */
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/bpstruct.h"
|
||||
#endif
|
||||
PACK_STRUCT_BEGIN
|
||||
struct netbios_resp
|
||||
{
|
||||
struct netbios_hdr resp_hdr;
|
||||
struct netbios_name_hdr resp_name;
|
||||
} PACK_STRUCT_STRUCT;
|
||||
PACK_STRUCT_END
|
||||
#ifdef PACK_STRUCT_USE_INCLUDES
|
||||
# include "arch/epstruct.h"
|
||||
#endif
|
||||
|
||||
#ifdef NETBIOS_LWIP_NAME
|
||||
#define NETBIOS_LOCAL_NAME NETBIOS_LWIP_NAME
|
||||
#else
|
||||
static char netbiosns_local_name[NETBIOS_NAME_LEN];
|
||||
#define NETBIOS_LOCAL_NAME netbiosns_local_name
|
||||
#endif
|
||||
|
||||
struct udp_pcb *netbiosns_pcb;
|
||||
|
||||
/** Decode a NetBIOS name (from packet to string) */
|
||||
static int
|
||||
netbiosns_name_decode(char *name_enc, char *name_dec, int name_dec_len)
|
||||
{
|
||||
char *pname;
|
||||
char cname;
|
||||
char cnbname;
|
||||
int idx = 0;
|
||||
|
||||
LWIP_UNUSED_ARG(name_dec_len);
|
||||
|
||||
/* Start decoding netbios name. */
|
||||
pname = name_enc;
|
||||
for (;;) {
|
||||
/* Every two characters of the first level-encoded name
|
||||
* turn into one character in the decoded name. */
|
||||
cname = *pname;
|
||||
if (cname == '\0')
|
||||
break; /* no more characters */
|
||||
if (cname == '.')
|
||||
break; /* scope ID follows */
|
||||
if (cname < 'A' || cname > 'Z') {
|
||||
/* Not legal. */
|
||||
return -1;
|
||||
}
|
||||
cname -= 'A';
|
||||
cnbname = cname << 4;
|
||||
pname++;
|
||||
|
||||
cname = *pname;
|
||||
if (cname == '\0' || cname == '.') {
|
||||
/* No more characters in the name - but we're in
|
||||
* the middle of a pair. Not legal. */
|
||||
return -1;
|
||||
}
|
||||
if (cname < 'A' || cname > 'Z') {
|
||||
/* Not legal. */
|
||||
return -1;
|
||||
}
|
||||
cname -= 'A';
|
||||
cnbname |= cname;
|
||||
pname++;
|
||||
|
||||
/* Do we have room to store the character? */
|
||||
if (idx < NETBIOS_NAME_LEN) {
|
||||
/* Yes - store the character. */
|
||||
name_dec[idx++] = (cnbname!=' '?cnbname:'\0');
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0 /* function currently unused */
|
||||
/** Encode a NetBIOS name (from string to packet) - currently unused because
|
||||
we don't ask for names. */
|
||||
static int
|
||||
netbiosns_name_encode(char *name_enc, char *name_dec, int name_dec_len)
|
||||
{
|
||||
char *pname;
|
||||
char cname;
|
||||
unsigned char ucname;
|
||||
int idx = 0;
|
||||
|
||||
/* Start encoding netbios name. */
|
||||
pname = name_enc;
|
||||
|
||||
for (;;) {
|
||||
/* Every two characters of the first level-encoded name
|
||||
* turn into one character in the decoded name. */
|
||||
cname = *pname;
|
||||
if (cname == '\0')
|
||||
break; /* no more characters */
|
||||
if (cname == '.')
|
||||
break; /* scope ID follows */
|
||||
if ((cname < 'A' || cname > 'Z') && (cname < '0' || cname > '9')) {
|
||||
/* Not legal. */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Do we have room to store the character? */
|
||||
if (idx >= name_dec_len) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Yes - store the character. */
|
||||
ucname = cname;
|
||||
name_dec[idx++] = ('A'+((ucname>>4) & 0x0F));
|
||||
name_dec[idx++] = ('A'+( ucname & 0x0F));
|
||||
pname++;
|
||||
}
|
||||
|
||||
/* Fill with "space" coding */
|
||||
for (;idx < name_dec_len - 1;) {
|
||||
name_dec[idx++] = 'C';
|
||||
name_dec[idx++] = 'A';
|
||||
}
|
||||
|
||||
/* Terminate string */
|
||||
name_dec[idx] = '\0';
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
/** NetBIOS Name service recv callback */
|
||||
static void
|
||||
netbiosns_recv(void *arg, struct udp_pcb *upcb, struct pbuf *p, const ip_addr_t *addr, u16_t port)
|
||||
{
|
||||
LWIP_UNUSED_ARG(arg);
|
||||
|
||||
/* if packet is valid */
|
||||
if (p != NULL) {
|
||||
char netbios_name[NETBIOS_NAME_LEN+1];
|
||||
struct netbios_hdr* netbios_hdr = (struct netbios_hdr*)p->payload;
|
||||
struct netbios_name_hdr* netbios_name_hdr = (struct netbios_name_hdr*)(netbios_hdr+1);
|
||||
|
||||
/* we only answer if we got a default interface */
|
||||
if (netif_default != NULL) {
|
||||
/* @todo: do we need to check answerRRs/authorityRRs/additionalRRs? */
|
||||
/* if the packet is a NetBIOS name query question */
|
||||
if (((netbios_hdr->flags & PP_NTOHS(NETB_HFLAG_OPCODE)) == PP_NTOHS(NETB_HFLAG_OPCODE_NAME_QUERY)) &&
|
||||
((netbios_hdr->flags & PP_NTOHS(NETB_HFLAG_RESPONSE)) == 0) &&
|
||||
(netbios_hdr->questions == PP_NTOHS(1))) {
|
||||
/* decode the NetBIOS name */
|
||||
netbiosns_name_decode((char*)(netbios_name_hdr->encname), netbios_name, sizeof(netbios_name));
|
||||
/* if the packet is for us */
|
||||
if (NETBIOS_STRCMP(netbios_name, NETBIOS_LOCAL_NAME) == 0) {
|
||||
struct pbuf *q;
|
||||
struct netbios_resp *resp;
|
||||
|
||||
q = pbuf_alloc(PBUF_TRANSPORT, sizeof(struct netbios_resp), PBUF_RAM);
|
||||
if (q != NULL) {
|
||||
resp = (struct netbios_resp*)q->payload;
|
||||
|
||||
/* prepare NetBIOS header response */
|
||||
resp->resp_hdr.trans_id = netbios_hdr->trans_id;
|
||||
resp->resp_hdr.flags = PP_HTONS(NETB_HFLAG_RESPONSE |
|
||||
NETB_HFLAG_OPCODE_NAME_QUERY |
|
||||
NETB_HFLAG_AUTHORATIVE |
|
||||
NETB_HFLAG_RECURS_DESIRED);
|
||||
resp->resp_hdr.questions = 0;
|
||||
resp->resp_hdr.answerRRs = PP_HTONS(1);
|
||||
resp->resp_hdr.authorityRRs = 0;
|
||||
resp->resp_hdr.additionalRRs = 0;
|
||||
|
||||
/* prepare NetBIOS header datas */
|
||||
MEMCPY( resp->resp_name.encname, netbios_name_hdr->encname, sizeof(netbios_name_hdr->encname));
|
||||
resp->resp_name.nametype = netbios_name_hdr->nametype;
|
||||
resp->resp_name.type = netbios_name_hdr->type;
|
||||
resp->resp_name.cls = netbios_name_hdr->cls;
|
||||
resp->resp_name.ttl = PP_HTONL(NETBIOS_NAME_TTL);
|
||||
resp->resp_name.datalen = PP_HTONS(sizeof(resp->resp_name.flags)+sizeof(resp->resp_name.addr));
|
||||
resp->resp_name.flags = PP_HTONS(NETB_NFLAG_NODETYPE_BNODE);
|
||||
ip4_addr_copy(resp->resp_name.addr, *netif_ip4_addr(netif_default));
|
||||
|
||||
/* send the NetBIOS response */
|
||||
udp_sendto(upcb, q, addr, port);
|
||||
|
||||
/* free the "reference" pbuf */
|
||||
pbuf_free(q);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* free the pbuf */
|
||||
pbuf_free(p);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
netbiosns_init(void)
|
||||
{
|
||||
#ifdef NETBIOS_LWIP_NAME
|
||||
LWIP_ASSERT("NetBIOS name is too long!", strlen(NETBIOS_LWIP_NAME) < NETBIOS_NAME_LEN);
|
||||
#endif
|
||||
|
||||
netbiosns_pcb = udp_new_ip_type(IPADDR_TYPE_ANY);
|
||||
if (netbiosns_pcb != NULL) {
|
||||
/* we have to be allowed to send broadcast packets! */
|
||||
netbiosns_pcb->so_options |= SOF_BROADCAST;
|
||||
udp_bind(netbiosns_pcb, IP_ANY_TYPE, NETBIOS_PORT);
|
||||
udp_recv(netbiosns_pcb, netbiosns_recv, netbiosns_pcb);
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NETBIOS_LWIP_NAME
|
||||
/* ATTENTION: the hostname must be <= 15 characters! */
|
||||
void
|
||||
netbiosns_set_name(const char* hostname)
|
||||
{
|
||||
size_t copy_len = strlen(hostname);
|
||||
LWIP_ASSERT("NetBIOS name is too long!", copy_len < NETBIOS_NAME_LEN);
|
||||
if(copy_len >= NETBIOS_NAME_LEN) {
|
||||
copy_len = NETBIOS_NAME_LEN - 1;
|
||||
}
|
||||
memcpy(netbiosns_local_name, hostname, copy_len + 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
netbiosns_stop(void)
|
||||
{
|
||||
if (netbiosns_pcb != NULL) {
|
||||
udp_remove(netbiosns_pcb);
|
||||
netbiosns_pcb = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* LWIP_IPV4 && LWIP_UDP */
|
||||
@@ -1,67 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{7DA7C0AB-0982-4BF5-9324-F59A7A08D65B}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>CCodeGeneration</RootNamespace>
|
||||
<AssemblyName>CCodeGeneration</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CFile.cs" />
|
||||
<Compile Include="Code.cs" />
|
||||
<Compile Include="CodeContainerBase.cs" />
|
||||
<Compile Include="CodeElement.cs" />
|
||||
<Compile Include="Comment.cs" />
|
||||
<Compile Include="EmptyLine.cs" />
|
||||
<Compile Include="Function.cs" />
|
||||
<Compile Include="CGenerator.cs" />
|
||||
<Compile Include="IfThenElse.cs" />
|
||||
<Compile Include="PlainText.cs" />
|
||||
<Compile Include="Switch.cs" />
|
||||
<Compile Include="PP_If.cs" />
|
||||
<Compile Include="PP_Ifdef.cs" />
|
||||
<Compile Include="PP_Include.cs" />
|
||||
<Compile Include="FunctionDeclaration.cs" />
|
||||
<Compile Include="PP_Macro.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="VariableDeclaration.cs" />
|
||||
<Compile Include="VariablePrototype.cs" />
|
||||
<Compile Include="VariableType.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace CCodeGeneration
|
||||
{
|
||||
public class CFile: CodeContainerBase
|
||||
{
|
||||
public CFile()
|
||||
{
|
||||
base.IncreaseLevel = false;
|
||||
}
|
||||
|
||||
public void Save(CGenerator generator)
|
||||
{
|
||||
if (generator == null)
|
||||
{
|
||||
throw new ArgumentNullException("generator");
|
||||
}
|
||||
|
||||
this.GenerateCode(0, generator);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace CCodeGeneration
|
||||
{
|
||||
public class CGenerator
|
||||
{
|
||||
public TextWriter OutputStream { get; private set; }
|
||||
public string File { get; private set; }
|
||||
public uint IndentCount { get; private set; }
|
||||
public string IndentChar { get; private set; }
|
||||
public string NewLine { get; private set; }
|
||||
|
||||
public CGenerator(System.IO.TextWriter outputStream, string file, uint indentCount, string indentChar, string newLine)
|
||||
{
|
||||
this.OutputStream = outputStream;
|
||||
this.File = file;
|
||||
this.IndentCount = indentCount;
|
||||
this.IndentChar = indentChar;
|
||||
this.NewLine = newLine;
|
||||
}
|
||||
|
||||
public string FileName
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(this.File))
|
||||
{
|
||||
return Path.GetFileName(this.File);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteSequence(string value, uint repetitions)
|
||||
{
|
||||
while (repetitions > 0)
|
||||
{
|
||||
this.OutputStream.Write(value);
|
||||
repetitions--;
|
||||
}
|
||||
}
|
||||
|
||||
public void IndentLine(int level)
|
||||
{
|
||||
while (level > 0)
|
||||
{
|
||||
WriteSequence(this.IndentChar, this.IndentCount);
|
||||
level--;
|
||||
}
|
||||
}
|
||||
|
||||
public void WriteNewLine()
|
||||
{
|
||||
this.OutputStream.Write(this.NewLine);
|
||||
}
|
||||
|
||||
public void WriteMultilineString(string value, int level = 0)
|
||||
{
|
||||
if (String.IsNullOrEmpty(value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// only \n and \r\n are recognized as linebreaks
|
||||
string[] lines = value.Split(new char[] { '\n' }, StringSplitOptions.None);
|
||||
|
||||
for (int l = 0; l < (lines.Length - 1); l++)
|
||||
{
|
||||
if (lines[l].EndsWith("\r"))
|
||||
{
|
||||
this.OutputStream.Write(lines[l].Substring(0, lines[l].Length-1));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.OutputStream.Write(lines[l]);
|
||||
}
|
||||
|
||||
this.WriteNewLine();
|
||||
this.IndentLine(level);
|
||||
}
|
||||
|
||||
this.OutputStream.Write(lines[lines.Length - 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace CCodeGeneration
|
||||
{
|
||||
public class Code: CodeElement
|
||||
{
|
||||
public string Code_ { get; set; }
|
||||
|
||||
public Code()
|
||||
{
|
||||
}
|
||||
|
||||
public Code(string code)
|
||||
{
|
||||
this.Code_ = code;
|
||||
}
|
||||
|
||||
public override void GenerateCode(int level, CGenerator generator)
|
||||
{
|
||||
generator.IndentLine(level);
|
||||
generator.WriteMultilineString(this.Code_, level);
|
||||
generator.WriteNewLine();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
|
||||
namespace CCodeGeneration
|
||||
{
|
||||
public class CodeContainerBase: CodeElement
|
||||
{
|
||||
private readonly List<CodeElement> declarations = new List<CodeElement>();
|
||||
private readonly List<CodeElement> innerElements = new List<CodeElement>();
|
||||
private bool increaseLevel = true;
|
||||
|
||||
public List<CodeElement> Declarations
|
||||
{
|
||||
get { return this.declarations; }
|
||||
}
|
||||
|
||||
public List<CodeElement> InnerElements
|
||||
{
|
||||
get { return this.innerElements; }
|
||||
}
|
||||
|
||||
protected bool IncreaseLevel
|
||||
{
|
||||
get { return this.increaseLevel; }
|
||||
set { this.increaseLevel = value; }
|
||||
}
|
||||
|
||||
public void AddElements(IList<CodeElement> elements, params CodeElement[] spacerElements)
|
||||
{
|
||||
if (elements != null)
|
||||
{
|
||||
if ((spacerElements == null) || (spacerElements.Length == 0))
|
||||
{
|
||||
this.innerElements.AddRange(elements);
|
||||
}
|
||||
else
|
||||
{
|
||||
bool spacerAdded = false;
|
||||
|
||||
foreach (CodeElement element in elements)
|
||||
{
|
||||
this.innerElements.Add(element);
|
||||
this.innerElements.AddRange(spacerElements);
|
||||
spacerAdded = true;
|
||||
}
|
||||
|
||||
if (spacerAdded)
|
||||
{
|
||||
// remove last spacer again
|
||||
this.innerElements.RemoveRange(this.innerElements.Count - spacerElements.Length, spacerElements.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public CodeElement AddElement(CodeElement element)
|
||||
{
|
||||
if (element != null)
|
||||
{
|
||||
this.innerElements.Add(element);
|
||||
}
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
public Code AddCode(string code)
|
||||
{
|
||||
return this.AddElement(new Code(code)) as Code;
|
||||
}
|
||||
|
||||
public Code AddCodeFormat(string codeFormat, params object[] args)
|
||||
{
|
||||
return this.AddElement(new Code(String.Format(codeFormat, args))) as Code;
|
||||
}
|
||||
|
||||
public CodeElement AddDeclaration(CodeElement declaration)
|
||||
{
|
||||
if (declaration != null)
|
||||
{
|
||||
this.declarations.Add(declaration);
|
||||
}
|
||||
|
||||
return declaration;
|
||||
}
|
||||
|
||||
public override void GenerateCode(int level, CGenerator generator)
|
||||
{
|
||||
if (this.increaseLevel)
|
||||
level++;
|
||||
|
||||
if (this.declarations.Count > 0)
|
||||
{
|
||||
foreach (CodeElement element in this.declarations)
|
||||
{
|
||||
element.GenerateCode(level, generator);
|
||||
}
|
||||
|
||||
EmptyLine.SingleLine.GenerateCode(level, generator);
|
||||
}
|
||||
|
||||
foreach (CodeElement element in this.innerElements)
|
||||
{
|
||||
element.GenerateCode(level, generator);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace CCodeGeneration
|
||||
{
|
||||
public class Comment: CodeElement
|
||||
{
|
||||
public const string CommentStart = "/*";
|
||||
public const string CommentEnd = "*/";
|
||||
|
||||
public string Comment_ { get; set; }
|
||||
public bool SingleLine { get; set; }
|
||||
|
||||
public Comment()
|
||||
{
|
||||
}
|
||||
|
||||
public Comment(string comment, bool singleLine = false)
|
||||
{
|
||||
this.Comment_ = comment;
|
||||
this.SingleLine = singleLine;
|
||||
}
|
||||
|
||||
public override void GenerateCode(int level, CGenerator generator)
|
||||
{
|
||||
generator.IndentLine(level);
|
||||
generator.OutputStream.Write(CommentStart);
|
||||
|
||||
if (!this.SingleLine)
|
||||
{
|
||||
generator.WriteNewLine();
|
||||
generator.IndentLine(level);
|
||||
generator.WriteMultilineString(this.Comment_, level);
|
||||
generator.WriteNewLine();
|
||||
generator.IndentLine(level);
|
||||
}
|
||||
else
|
||||
{
|
||||
generator.OutputStream.Write(" " + Comment_ + " ");
|
||||
}
|
||||
|
||||
generator.OutputStream.Write(CommentEnd);
|
||||
generator.WriteNewLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace CCodeGeneration
|
||||
{
|
||||
public class EmptyLine : CodeElement
|
||||
{
|
||||
public static readonly EmptyLine SingleLine = new EmptyLine();
|
||||
public static readonly EmptyLine TwoLines = new EmptyLine(2);
|
||||
public static readonly EmptyLine ThreeLines = new EmptyLine(3);
|
||||
|
||||
public uint Count { get; set; }
|
||||
|
||||
public EmptyLine()
|
||||
{
|
||||
this.Count = 1;
|
||||
}
|
||||
|
||||
public EmptyLine(uint count)
|
||||
{
|
||||
this.Count = count;
|
||||
}
|
||||
|
||||
public override void GenerateCode(int level, CGenerator generator)
|
||||
{
|
||||
uint c = this.Count;
|
||||
|
||||
while (c > 0)
|
||||
{
|
||||
generator.WriteNewLine();
|
||||
c--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CCodeGeneration
|
||||
{
|
||||
public class Function: CodeContainerBase
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool IsStatic { get; set; }
|
||||
|
||||
private readonly List<VariableType> parameter = new List<VariableType>();
|
||||
private VariableType returnType = VariableType.Void;
|
||||
|
||||
public Function()
|
||||
{
|
||||
}
|
||||
|
||||
public Function(string name, bool isStatic = false)
|
||||
{
|
||||
this.Name = name;
|
||||
this.IsStatic = isStatic;
|
||||
}
|
||||
|
||||
public List<VariableType> Parameter
|
||||
{
|
||||
get { return this.parameter; }
|
||||
}
|
||||
|
||||
public VariableType ReturnType
|
||||
{
|
||||
get { return this.returnType; }
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("ReturnValue");
|
||||
}
|
||||
this.returnType = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static Function FromDeclaration(FunctionDeclaration decl)
|
||||
{
|
||||
Function result = new Function(decl.Name, decl.IsStatic);
|
||||
result.ReturnType = decl.ReturnType.Clone() as VariableType;
|
||||
|
||||
foreach (VariableType param in decl.Parameter)
|
||||
{
|
||||
result.parameter.Add(param.Clone() as VariableType);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override void GenerateCode(int level, CGenerator generator)
|
||||
{
|
||||
generator.IndentLine(level);
|
||||
|
||||
if (this.IsStatic)
|
||||
{
|
||||
generator.OutputStream.Write("static ");
|
||||
}
|
||||
|
||||
this.returnType.GenerateCode(generator);
|
||||
generator.OutputStream.Write(" " + this.Name + "(");
|
||||
|
||||
if (this.Parameter.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < this.parameter.Count; i++)
|
||||
{
|
||||
this.parameter[i].GenerateCode(generator);
|
||||
|
||||
if (i < (this.parameter.Count - 1))
|
||||
{
|
||||
generator.OutputStream.Write(", ");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
generator.OutputStream.Write("void");
|
||||
}
|
||||
|
||||
generator.OutputStream.Write(")");
|
||||
generator.WriteNewLine();
|
||||
generator.IndentLine(level);
|
||||
generator.OutputStream.Write("{");
|
||||
generator.WriteNewLine();
|
||||
|
||||
base.GenerateCode(level, generator);
|
||||
|
||||
generator.IndentLine(level);
|
||||
generator.OutputStream.Write("}");
|
||||
generator.WriteNewLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CCodeGeneration
|
||||
{
|
||||
public class FunctionDeclaration: CodeElement
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public bool IsStatic { get; set; }
|
||||
public bool IsExtern { get; set; }
|
||||
|
||||
private readonly List<VariableType> parameter = new List<VariableType>();
|
||||
private VariableType returnType = VariableType.Void;
|
||||
|
||||
public FunctionDeclaration()
|
||||
{
|
||||
}
|
||||
|
||||
public FunctionDeclaration(string name, bool isStatic = false, bool isExtern = false)
|
||||
{
|
||||
this.Name = name;
|
||||
this.IsStatic = isStatic;
|
||||
this.IsExtern = isExtern;
|
||||
}
|
||||
|
||||
public List<VariableType> Parameter
|
||||
{
|
||||
get { return this.parameter; }
|
||||
}
|
||||
|
||||
public VariableType ReturnType
|
||||
{
|
||||
get { return this.returnType; }
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new ArgumentNullException("ReturnValue");
|
||||
}
|
||||
this.returnType = value;
|
||||
}
|
||||
}
|
||||
|
||||
public override void GenerateCode(int level, CGenerator generator)
|
||||
{
|
||||
generator.IndentLine(level);
|
||||
|
||||
if (this.IsExtern)
|
||||
{
|
||||
generator.OutputStream.Write("extern ");
|
||||
}
|
||||
|
||||
if (this.IsStatic)
|
||||
{
|
||||
generator.OutputStream.Write("static ");
|
||||
}
|
||||
|
||||
this.returnType.GenerateCode(generator);
|
||||
generator.OutputStream.Write(" " + this.Name + "(");
|
||||
|
||||
if (this.Parameter.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < this.parameter.Count; i++)
|
||||
{
|
||||
this.parameter[i].GenerateCode(generator);
|
||||
|
||||
if (i < (this.parameter.Count - 1))
|
||||
{
|
||||
generator.OutputStream.Write(", ");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
generator.OutputStream.Write("void");
|
||||
}
|
||||
|
||||
generator.OutputStream.Write(");");
|
||||
generator.WriteNewLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CCodeGeneration
|
||||
{
|
||||
public class ElseIf : CodeContainerBase
|
||||
{
|
||||
public string Condition { get; set; }
|
||||
|
||||
public ElseIf()
|
||||
{
|
||||
}
|
||||
|
||||
public ElseIf(string condition)
|
||||
{
|
||||
this.Condition = condition;
|
||||
}
|
||||
|
||||
public override void GenerateCode(int level, CGenerator generator)
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(this.Condition))
|
||||
{
|
||||
generator.IndentLine(level);
|
||||
generator.OutputStream.Write(String.Format("else if ({0})", this.Condition));
|
||||
generator.WriteNewLine();
|
||||
generator.IndentLine(level);
|
||||
generator.OutputStream.Write("{");
|
||||
generator.WriteNewLine();
|
||||
|
||||
base.GenerateCode(level, generator);
|
||||
|
||||
generator.IndentLine(level);
|
||||
generator.OutputStream.Write("}");
|
||||
generator.WriteNewLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class IfThenElse: CodeContainerBase
|
||||
{
|
||||
public string Condition { get; set; }
|
||||
|
||||
private List<ElseIf> elseIf = new List<ElseIf>();
|
||||
private CodeContainerBase else_ = new CodeContainerBase();
|
||||
|
||||
public IfThenElse()
|
||||
{
|
||||
}
|
||||
|
||||
public IfThenElse(string condition)
|
||||
{
|
||||
this.Condition = condition;
|
||||
}
|
||||
|
||||
public List<ElseIf> ElseIf
|
||||
{
|
||||
get { return this.elseIf; }
|
||||
}
|
||||
|
||||
public CodeContainerBase Else
|
||||
{
|
||||
get { return this.else_; }
|
||||
}
|
||||
|
||||
public override void GenerateCode(int level, CGenerator generator)
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(this.Condition))
|
||||
{
|
||||
generator.IndentLine(level);
|
||||
generator.OutputStream.Write(String.Format("if ({0})", this.Condition));
|
||||
generator.WriteNewLine();
|
||||
generator.IndentLine(level);
|
||||
generator.OutputStream.Write("{");
|
||||
generator.WriteNewLine();
|
||||
|
||||
base.GenerateCode(level, generator);
|
||||
|
||||
generator.IndentLine(level);
|
||||
generator.OutputStream.Write("}");
|
||||
generator.WriteNewLine();
|
||||
|
||||
foreach (ElseIf elif in this.elseIf)
|
||||
{
|
||||
elif.GenerateCode(level, generator);
|
||||
}
|
||||
|
||||
if (this.else_.InnerElements.Count > 0)
|
||||
{
|
||||
generator.IndentLine(level);
|
||||
generator.OutputStream.Write("else");
|
||||
generator.WriteNewLine();
|
||||
generator.IndentLine(level);
|
||||
generator.OutputStream.Write("{");
|
||||
generator.WriteNewLine();
|
||||
|
||||
this.else_.GenerateCode(level, generator);
|
||||
|
||||
generator.IndentLine(level);
|
||||
generator.OutputStream.Write("}");
|
||||
generator.WriteNewLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace CCodeGeneration
|
||||
{
|
||||
public class PP_If: CodeContainerBase
|
||||
{
|
||||
public string Condition { get; set; }
|
||||
|
||||
public PP_If()
|
||||
{
|
||||
base.IncreaseLevel = false;
|
||||
}
|
||||
|
||||
public PP_If(string condition)
|
||||
: this()
|
||||
{
|
||||
this.Condition = condition;
|
||||
}
|
||||
|
||||
|
||||
public override void GenerateCode(int level, CGenerator generator)
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(this.Condition))
|
||||
{
|
||||
generator.OutputStream.Write("#if " + this.Condition);
|
||||
generator.WriteNewLine();
|
||||
|
||||
base.GenerateCode(level, generator);
|
||||
|
||||
generator.OutputStream.Write("#endif /* " + this.Condition + " */");
|
||||
generator.WriteNewLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace CCodeGeneration
|
||||
{
|
||||
public class PP_Include : CodeElement
|
||||
{
|
||||
public string File { get; set; }
|
||||
public bool IsLocal { get; set; }
|
||||
|
||||
public PP_Include()
|
||||
{
|
||||
this.IsLocal = true;
|
||||
}
|
||||
|
||||
public PP_Include(string file, bool isLocal = true)
|
||||
{
|
||||
this.File = file;
|
||||
this.IsLocal = isLocal;
|
||||
}
|
||||
|
||||
public override void GenerateCode(int level, CGenerator generator)
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(this.File))
|
||||
{
|
||||
// includes are never indented
|
||||
if (this.IsLocal)
|
||||
{
|
||||
generator.OutputStream.Write("#include \"" + this.File + "\"");
|
||||
}
|
||||
else
|
||||
{
|
||||
generator.OutputStream.Write("#include <" + this.File + ">");
|
||||
}
|
||||
|
||||
generator.WriteNewLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace CCodeGeneration
|
||||
{
|
||||
public class PP_Macro: CodeElement
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
|
||||
public PP_Macro()
|
||||
{
|
||||
}
|
||||
|
||||
public PP_Macro(string name, string value)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Value = value;
|
||||
}
|
||||
|
||||
|
||||
public override void GenerateCode(int level, CGenerator generator)
|
||||
{
|
||||
// macros are not indented at all
|
||||
generator.OutputStream.Write("#define " + this.Name + " ");
|
||||
generator.WriteMultilineString(this.Value);
|
||||
generator.WriteNewLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
// die mit einer Assembly verknüpft sind.
|
||||
[assembly: AssemblyTitle("CCodeGeneration")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("CCodeGeneration")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
|
||||
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
|
||||
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
|
||||
[assembly: Guid("8f07a0fa-86f4-48a0-97c7-f94fc5c3f103")]
|
||||
|
||||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
//
|
||||
// Hauptversion
|
||||
// Nebenversion
|
||||
// Buildnummer
|
||||
// Revision
|
||||
//
|
||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,146 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CCodeGeneration
|
||||
{
|
||||
public class SwitchCase : CodeContainerBase
|
||||
{
|
||||
public string Value { get; set; }
|
||||
|
||||
public SwitchCase()
|
||||
{
|
||||
}
|
||||
|
||||
public SwitchCase(string value)
|
||||
{
|
||||
this.Value = value;
|
||||
}
|
||||
|
||||
public bool IsDefault
|
||||
{
|
||||
get { return (this.Value.ToLowerInvariant() == "default"); }
|
||||
}
|
||||
|
||||
public static SwitchCase GenerateDefault()
|
||||
{
|
||||
return new SwitchCase("default");
|
||||
}
|
||||
|
||||
public override void GenerateCode(int level, CGenerator generator)
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(this.Value))
|
||||
{
|
||||
generator.IndentLine(level);
|
||||
if (this.IsDefault)
|
||||
{
|
||||
generator.OutputStream.Write("default:");
|
||||
}
|
||||
else
|
||||
{
|
||||
generator.OutputStream.Write(String.Format("case {0}:", this.Value));
|
||||
}
|
||||
generator.WriteNewLine();
|
||||
generator.IndentLine(level + 1);
|
||||
generator.OutputStream.Write("{");
|
||||
generator.WriteNewLine();
|
||||
|
||||
base.GenerateCode(level + 1, generator);
|
||||
|
||||
generator.IndentLine(level + 1);
|
||||
generator.OutputStream.Write("}");
|
||||
generator.WriteNewLine();
|
||||
|
||||
generator.IndentLine(level + 1);
|
||||
generator.OutputStream.Write("break;");
|
||||
generator.WriteNewLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Switch: CodeElement
|
||||
{
|
||||
public string SwitchVar { get; set; }
|
||||
|
||||
private List<SwitchCase> switches = new List<SwitchCase>();
|
||||
|
||||
public Switch()
|
||||
{
|
||||
}
|
||||
|
||||
public Switch(string switchVar)
|
||||
{
|
||||
this.SwitchVar = switchVar;
|
||||
}
|
||||
|
||||
public List<SwitchCase> Switches
|
||||
{
|
||||
get { return this.switches; }
|
||||
}
|
||||
|
||||
public override void GenerateCode(int level, CGenerator generator)
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(this.SwitchVar))
|
||||
{
|
||||
generator.IndentLine(level);
|
||||
generator.OutputStream.Write(String.Format("switch ({0})", this.SwitchVar));
|
||||
generator.WriteNewLine();
|
||||
generator.IndentLine(level);
|
||||
generator.OutputStream.Write("{");
|
||||
generator.WriteNewLine();
|
||||
|
||||
SwitchCase defaultCase = null; // generate 'default' always as last case
|
||||
foreach (SwitchCase switchCase in this.switches)
|
||||
{
|
||||
if (switchCase.IsDefault)
|
||||
{
|
||||
defaultCase = switchCase;
|
||||
}
|
||||
else
|
||||
{
|
||||
switchCase.GenerateCode(level + 1, generator);
|
||||
}
|
||||
}
|
||||
if (defaultCase != null)
|
||||
{
|
||||
defaultCase.GenerateCode(level + 1, generator);
|
||||
}
|
||||
|
||||
generator.IndentLine(level);
|
||||
generator.OutputStream.Write("}");
|
||||
generator.WriteNewLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace CCodeGeneration
|
||||
{
|
||||
public class VariableDeclaration : CodeElement
|
||||
{
|
||||
public VariableType Type { get; set; }
|
||||
public string InitialValue { get; set; }
|
||||
public bool IsStatic { get; set; }
|
||||
|
||||
public VariableDeclaration()
|
||||
: base()
|
||||
{
|
||||
}
|
||||
|
||||
public VariableDeclaration(VariableType type, string initialValue = null, bool isStatic = false) :
|
||||
base()
|
||||
{
|
||||
this.Type = type;
|
||||
this.InitialValue = initialValue;
|
||||
this.IsStatic = isStatic;
|
||||
}
|
||||
|
||||
public override void GenerateCode(int level, CGenerator generator)
|
||||
{
|
||||
if (this.Type != null)
|
||||
{
|
||||
generator.IndentLine(level);
|
||||
|
||||
if (this.IsStatic)
|
||||
{
|
||||
generator.OutputStream.Write("static ");
|
||||
}
|
||||
|
||||
// declare the variable
|
||||
this.Type.GenerateCode(generator);
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(this.InitialValue))
|
||||
{
|
||||
// add initialization value
|
||||
generator.OutputStream.Write(" = ");
|
||||
generator.WriteMultilineString(this.InitialValue, level);
|
||||
}
|
||||
|
||||
generator.OutputStream.Write(";");
|
||||
generator.WriteNewLine();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace CCodeGeneration
|
||||
{
|
||||
public enum ConstType
|
||||
{
|
||||
None,
|
||||
Value,
|
||||
Indirection,
|
||||
Both
|
||||
}
|
||||
|
||||
public class VariableType : ICloneable
|
||||
{
|
||||
public const string VoidString = "void";
|
||||
public static readonly VariableType Void = new VariableType(null, "void");
|
||||
|
||||
public string Name { get; set; }
|
||||
public string Type { get; set; }
|
||||
public string Indirection { get; set; }
|
||||
public ConstType Const { get; set; }
|
||||
public string ArraySpecifier { get; set; }
|
||||
|
||||
public VariableType()
|
||||
{
|
||||
}
|
||||
|
||||
public VariableType(string name, string type, string indirection = null, ConstType const_ = ConstType.None, string arraySpecifier = null)
|
||||
{
|
||||
this.Name = name;
|
||||
this.Type = type;
|
||||
this.Indirection = indirection;
|
||||
this.Const = const_;
|
||||
this.ArraySpecifier = arraySpecifier;
|
||||
}
|
||||
|
||||
public void GenerateCode(CGenerator generator)
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(this.Type))
|
||||
{
|
||||
generator.OutputStream.Write(this.ToString().Trim());
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(this.Type))
|
||||
{
|
||||
StringBuilder vt = new StringBuilder();
|
||||
|
||||
if ((this.Const == ConstType.Value) || (this.Const == ConstType.Both))
|
||||
{
|
||||
vt.Append("const ");
|
||||
}
|
||||
|
||||
vt.Append(this.Type);
|
||||
vt.Append(" ");
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(this.Indirection))
|
||||
{
|
||||
vt.Append(this.Indirection);
|
||||
}
|
||||
|
||||
if ((this.Const == ConstType.Indirection) || (this.Const == ConstType.Both))
|
||||
{
|
||||
vt.Append("const ");
|
||||
}
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(this.Name))
|
||||
{
|
||||
vt.Append(this.Name);
|
||||
}
|
||||
|
||||
if (this.ArraySpecifier != null)
|
||||
{
|
||||
vt.Append("[");
|
||||
vt.Append(this.ArraySpecifier);
|
||||
vt.Append("]");
|
||||
}
|
||||
|
||||
return vt.ToString().Trim();
|
||||
}
|
||||
|
||||
return base.ToString();
|
||||
}
|
||||
|
||||
#region ICloneable Member
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
// we only have value types as members -> simply use .net base function
|
||||
return this.MemberwiseClone();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LwipMibCompiler", "LwipMibCompiler\LwipMibCompiler.csproj", "{C25D5640-D999-49BD-82E0-A1975296A91E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LwipSnmpCodeGeneration", "LwipSnmpCodeGeneration\LwipSnmpCodeGeneration.csproj", "{AABCAB90-1540-45D4-A159-14831A54E9A3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CCodeGeneration", "CCodeGeneration\CCodeGeneration.csproj", "{7DA7C0AB-0982-4BF5-9324-F59A7A08D65B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpSnmpLib.Mib", "SharpSnmpLib\SharpSnmpLib.Mib.csproj", "{CBE20411-5DB7-487D-825D-7694267BB6F5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LwipMibViewer", "LwipMibViewer\LwipMibViewer.csproj", "{86CC0B65-7985-4017-A252-0A7A18DCAEF3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{7DA7C0AB-0982-4BF5-9324-F59A7A08D65B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7DA7C0AB-0982-4BF5-9324-F59A7A08D65B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7DA7C0AB-0982-4BF5-9324-F59A7A08D65B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7DA7C0AB-0982-4BF5-9324-F59A7A08D65B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{86CC0B65-7985-4017-A252-0A7A18DCAEF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{86CC0B65-7985-4017-A252-0A7A18DCAEF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{86CC0B65-7985-4017-A252-0A7A18DCAEF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{86CC0B65-7985-4017-A252-0A7A18DCAEF3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{AABCAB90-1540-45D4-A159-14831A54E9A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{AABCAB90-1540-45D4-A159-14831A54E9A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{AABCAB90-1540-45D4-A159-14831A54E9A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{AABCAB90-1540-45D4-A159-14831A54E9A3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{C25D5640-D999-49BD-82E0-A1975296A91E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C25D5640-D999-49BD-82E0-A1975296A91E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C25D5640-D999-49BD-82E0-A1975296A91E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C25D5640-D999-49BD-82E0-A1975296A91E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CBE20411-5DB7-487D-825D-7694267BB6F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CBE20411-5DB7-487D-825D-7694267BB6F5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CBE20411-5DB7-487D-825D-7694267BB6F5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CBE20411-5DB7-487D-825D-7694267BB6F5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
StartupItem = LwipMibCompiler\LwipMibCompiler.csproj
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,73 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{C25D5640-D999-49BD-82E0-A1975296A91E}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>LwipMibCompiler</RootNamespace>
|
||||
<AssemblyName>LwipMibCompiler</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>false</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Optimize>false</Optimize>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CCodeGeneration\CCodeGeneration.csproj">
|
||||
<Project>{7DA7C0AB-0982-4BF5-9324-F59A7A08D65B}</Project>
|
||||
<Name>CCodeGeneration</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\LwipSnmpCodeGeneration\LwipSnmpCodeGeneration.csproj">
|
||||
<Project>{AABCAB90-1540-45D4-A159-14831A54E9A3}</Project>
|
||||
<Name>LwipSnmpCodeGeneration</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SharpSnmpLib\SharpSnmpLib.Mib.csproj">
|
||||
<Project>{CBE20411-5DB7-487D-825D-7694267BB6F5}</Project>
|
||||
<Name>SharpSnmpLib.Mib</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,480 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using CCodeGeneration;
|
||||
using Lextm.SharpSnmpLib.Mib;
|
||||
using Lextm.SharpSnmpLib.Mib.Elements.Entities;
|
||||
using Lextm.SharpSnmpLib.Mib.Elements.Types;
|
||||
using LwipSnmpCodeGeneration;
|
||||
|
||||
namespace LwipMibCompiler
|
||||
{
|
||||
class Program
|
||||
{
|
||||
private static readonly Regex _alphaNumericRegex = new Regex("[^a-zA-Z0-9]");
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("lwIP MIB Compiler");
|
||||
Console.WriteLine("");
|
||||
|
||||
// check args
|
||||
if ((args.Length < 2) || String.IsNullOrWhiteSpace(args[0]) || String.IsNullOrWhiteSpace(args[1]))
|
||||
{
|
||||
PrintUsage();
|
||||
return;
|
||||
}
|
||||
|
||||
string mibFile = args[0];
|
||||
if (!File.Exists(mibFile))
|
||||
{
|
||||
Console.WriteLine(String.Format("Unable to find file '{0}'!", mibFile));
|
||||
}
|
||||
|
||||
string destFile = args[1];
|
||||
string destHeaderFile;
|
||||
|
||||
if (Directory.Exists(destFile))
|
||||
{
|
||||
// only directory passed -> create dest filename from mib filename
|
||||
string mibFileName = Path.GetFileNameWithoutExtension(mibFile).ToLowerInvariant();
|
||||
destFile = Path.Combine(destFile, mibFileName + ".c");
|
||||
}
|
||||
|
||||
string destFileExt = Path.GetExtension(destFile);
|
||||
if (!String.IsNullOrEmpty(destFileExt))
|
||||
{
|
||||
destHeaderFile = destFile.Substring(0, destFile.Length - destFileExt.Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
destHeaderFile = destFile;
|
||||
}
|
||||
destHeaderFile += ".h";
|
||||
|
||||
for (int i=2; i<args.Length; i++)
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(args[i]) && Directory.Exists(args[i]))
|
||||
{
|
||||
MibTypesResolver.RegisterResolver(new FileSystemMibResolver(args[i], true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// read and resolve MIB
|
||||
Console.WriteLine(" Reading MIB file...");
|
||||
|
||||
MibDocument md = new MibDocument(mibFile);
|
||||
MibTypesResolver.ResolveTypes(md.Modules[0]);
|
||||
MibTree mt = new MibTree(md.Modules[0] as MibModule);
|
||||
|
||||
if (mt.Root.Count == 0)
|
||||
{
|
||||
Console.WriteLine("No root element found inside MIB!");
|
||||
return;
|
||||
}
|
||||
|
||||
MibCFile generatedFile = new MibCFile();
|
||||
MibHeaderFile generatedHeaderFile = new MibHeaderFile();
|
||||
|
||||
foreach (MibTreeNode mibTreeNode in mt.Root)
|
||||
{
|
||||
// create LWIP object tree from MIB structure
|
||||
Console.WriteLine(" Creating lwIP object tree " + mibTreeNode.Entity.Name);
|
||||
|
||||
SnmpMib snmpMib = new SnmpMib();
|
||||
snmpMib.Oid = mibTreeNode.Entity.Value;
|
||||
snmpMib.BaseOid = MibTypesResolver.ResolveOid(mibTreeNode.Entity).GetOidValues();
|
||||
snmpMib.Name = mibTreeNode.Entity.Name;
|
||||
|
||||
ProcessMibTreeNode(mibTreeNode, snmpMib);
|
||||
|
||||
// let the tree transform itself depending on node structure
|
||||
snmpMib.Analyze();
|
||||
|
||||
if (snmpMib.ChildNodes.Count != 0)
|
||||
{
|
||||
// generate code from LWIP object tree
|
||||
Console.WriteLine(" Generating code " + snmpMib.Name);
|
||||
snmpMib.Generate(generatedFile, generatedHeaderFile);
|
||||
}
|
||||
}
|
||||
|
||||
string preservedCode = MibCFile.GetPreservedCode(destFile);
|
||||
if (!string.IsNullOrEmpty(preservedCode))
|
||||
{
|
||||
generatedFile.PreservedCode.Add(new PlainText(preservedCode));
|
||||
}
|
||||
else
|
||||
{
|
||||
generatedFile.PreservedCode.AddRange(generatedFile.Implementation);
|
||||
}
|
||||
generatedFile.Implementation.Clear();
|
||||
|
||||
|
||||
using (StreamWriter fileWriter = new StreamWriter(destHeaderFile))
|
||||
{
|
||||
CGenerator cGenerator = new CGenerator(fileWriter, destHeaderFile, 3, " ", Environment.NewLine);
|
||||
generatedHeaderFile.Save(cGenerator);
|
||||
}
|
||||
using (StreamWriter fileWriter = new StreamWriter(destFile))
|
||||
{
|
||||
CGenerator cGenerator = new CGenerator(fileWriter, destFile, 3, " ", Environment.NewLine);
|
||||
generatedFile.Save(cGenerator);
|
||||
}
|
||||
|
||||
Console.WriteLine(" Done");
|
||||
}
|
||||
|
||||
private static void PrintUsage()
|
||||
{
|
||||
string codeBase = Assembly.GetExecutingAssembly().CodeBase;
|
||||
string appName = Path.GetFileName(codeBase);
|
||||
|
||||
Console.WriteLine("Usage:");
|
||||
Console.WriteLine(String.Format(" {0} <source MIB file> <dest C file> [<search path 1 for referred MIB's> <search path 2 for referred MIB's> ...]", appName));
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" <source MIB file>");
|
||||
Console.WriteLine(" Path and filename of MIB file to convert.");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" <dest C file>");
|
||||
Console.WriteLine(" Destination path and file. If a path is passed only, filename is auto");
|
||||
Console.WriteLine(" generated from MIB file name.");
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine(" <search path X for referred MIB's>");
|
||||
Console.WriteLine(" It's important to provide all referred MIB's in order to correctly ");
|
||||
Console.WriteLine(" resolve all used types.");
|
||||
Console.WriteLine("");
|
||||
}
|
||||
|
||||
|
||||
#region Generation of LWIP Object Tree
|
||||
|
||||
private static void ProcessMibTreeNode(MibTreeNode mibTreeNode, SnmpTreeNode assignedSnmpNode)
|
||||
{
|
||||
foreach (MibTreeNode mtn in mibTreeNode.ChildNodes)
|
||||
{
|
||||
// in theory container nodes may also be scalars or tables at the same time (for now only process real containers)
|
||||
if (mtn.NodeType == MibTreeNodeType.Container)
|
||||
{
|
||||
SnmpTreeNode snmpTreeNode = GenerateSnmpTreeNode(mtn, assignedSnmpNode);
|
||||
assignedSnmpNode.ChildNodes.Add(snmpTreeNode);
|
||||
|
||||
ProcessMibTreeNode(mtn, snmpTreeNode);
|
||||
}
|
||||
else if ((mtn.NodeType & MibTreeNodeType.Scalar) != 0)
|
||||
{
|
||||
SnmpScalarNode snmpScalarNode = GenerateSnmpScalarNode(mtn, assignedSnmpNode);
|
||||
if (snmpScalarNode != null)
|
||||
{
|
||||
assignedSnmpNode.ChildNodes.Add(snmpScalarNode);
|
||||
}
|
||||
}
|
||||
else if ((mtn.NodeType & MibTreeNodeType.Table) != 0)
|
||||
{
|
||||
SnmpTableNode snmpTableNode = GenerateSnmpTableNode(mtn, assignedSnmpNode);
|
||||
if (snmpTableNode != null)
|
||||
{
|
||||
assignedSnmpNode.ChildNodes.Add(snmpTableNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static SnmpTreeNode GenerateSnmpTreeNode(MibTreeNode mibTreeNode, SnmpTreeNode parentNode)
|
||||
{
|
||||
SnmpTreeNode result = new SnmpTreeNode(parentNode);
|
||||
result.Name = _alphaNumericRegex.Replace (mibTreeNode.Entity.Name, "");
|
||||
result.Oid = mibTreeNode.Entity.Value;
|
||||
result.FullOid = MibTypesResolver.ResolveOid(mibTreeNode.Entity).GetOidString();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static SnmpScalarNode GenerateSnmpScalarNode(MibTreeNode mibTreeNode, SnmpTreeNode parentNode, bool ignoreAccessibleFlag = false)
|
||||
{
|
||||
ObjectType ote = mibTreeNode.Entity as ObjectType;
|
||||
if (ote != null)
|
||||
{
|
||||
return GenerateSnmpScalarNode(ote, parentNode, ignoreAccessibleFlag);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static SnmpScalarNode GenerateSnmpScalarNode(ObjectType ote, SnmpTreeNode parentNode, bool ignoreAccessibleFlag = false)
|
||||
{
|
||||
SnmpScalarNode result;
|
||||
|
||||
ITypeAssignment mibType = ote.BaseType;
|
||||
IntegerType it = (mibType as IntegerType);
|
||||
if (it != null)
|
||||
{
|
||||
if (ote.ReferredType.Name == Symbol.TruthValue.ToString())
|
||||
{
|
||||
result = new SnmpScalarNodeTruthValue(parentNode);
|
||||
}
|
||||
else if ((it.Type == IntegerType.Types.Integer) || (it.Type == IntegerType.Types.Integer32))
|
||||
{
|
||||
result = new SnmpScalarNodeInt(parentNode);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(String.Format("Unsupported IntegerType '{0}'!", it.Type));
|
||||
return null;
|
||||
}
|
||||
if (it.IsEnumeration)
|
||||
{
|
||||
result.Restrictions.AddRange(CreateRestrictions(it.Enumeration));
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Restrictions.AddRange(CreateRestrictions(it.Ranges));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UnsignedType ut = (mibType as UnsignedType);
|
||||
if (ut != null)
|
||||
{
|
||||
if ((ut.Type == UnsignedType.Types.Unsigned32) ||
|
||||
(ut.Type == UnsignedType.Types.Gauge32))
|
||||
{
|
||||
result = new SnmpScalarNodeUint(SnmpDataType.Gauge, parentNode);
|
||||
}
|
||||
else if (ut.Type == UnsignedType.Types.Counter32)
|
||||
{
|
||||
result = new SnmpScalarNodeUint(SnmpDataType.Counter, parentNode);
|
||||
}
|
||||
else if (ut.Type == UnsignedType.Types.TimeTicks)
|
||||
{
|
||||
result = new SnmpScalarNodeUint(SnmpDataType.TimeTicks, parentNode);
|
||||
}
|
||||
else if (ut.Type == UnsignedType.Types.Counter64)
|
||||
{
|
||||
result = new SnmpScalarNodeCounter64(parentNode);
|
||||
if ((ut.Ranges != null) && (ut.Ranges.Count > 0))
|
||||
{
|
||||
Console.WriteLine(String.Format("Generation of ranges is not supported for Counter64 type!"));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(String.Format("Unsupported UnsignedType '{0}'!", ut.Type));
|
||||
return null;
|
||||
}
|
||||
result.Restrictions.AddRange(CreateRestrictions(ut.Ranges));
|
||||
}
|
||||
else if (mibType is IpAddressType)
|
||||
{
|
||||
result = new SnmpScalarNodeOctetString(SnmpDataType.IpAddress, parentNode);
|
||||
result.Restrictions.AddRange(CreateRestrictions((mibType as OctetStringType).Size));
|
||||
}
|
||||
else if (mibType is OpaqueType)
|
||||
{
|
||||
result = new SnmpScalarNodeOctetString(SnmpDataType.Opaque, parentNode);
|
||||
result.Restrictions.AddRange(CreateRestrictions((mibType as OctetStringType).Size));
|
||||
}
|
||||
else if (mibType is OctetStringType)
|
||||
{
|
||||
result = new SnmpScalarNodeOctetString(SnmpDataType.OctetString, parentNode);
|
||||
result.Restrictions.AddRange(CreateRestrictions((mibType as OctetStringType).Size));
|
||||
}
|
||||
else if (mibType is ObjectIdentifierType)
|
||||
{
|
||||
result = new SnmpScalarNodeObjectIdentifier(parentNode);
|
||||
}
|
||||
else if (mibType is BitsType)
|
||||
{
|
||||
result = new SnmpScalarNodeBits(parentNode, (uint)((mibType as BitsType).Map.GetHighestValue() + 1));
|
||||
result.Restrictions.AddRange(CreateRestrictions(mibType as BitsType));
|
||||
}
|
||||
else
|
||||
{
|
||||
TypeAssignment ta = mibType as TypeAssignment;
|
||||
if (ta != null)
|
||||
{
|
||||
Console.WriteLine(String.Format("Unsupported BaseType: Module='{0}', Name='{1}', Type='{2}'!", ta.Module.Name, ta.Name, ta.Type));
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine(String.Format("Unsupported BaseType: Module='{0}', Name='{1}'!", mibType.Module, mibType.Name));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
result.Name = _alphaNumericRegex.Replace(ote.Name, "");
|
||||
result.Oid = ote.Value;
|
||||
|
||||
if (ote.Access == MaxAccess.readWrite)
|
||||
{
|
||||
result.AccessMode = SnmpAccessMode.ReadWrite;
|
||||
}
|
||||
else if (ote.Access == MaxAccess.readOnly)
|
||||
{
|
||||
result.AccessMode = SnmpAccessMode.ReadOnly;
|
||||
}
|
||||
else if (ote.Access == MaxAccess.readCreate)
|
||||
{
|
||||
result.AccessMode = SnmpAccessMode.ReadOnly;
|
||||
}
|
||||
else if (ignoreAccessibleFlag && (ote.Access == MaxAccess.notAccessible))
|
||||
{
|
||||
result.AccessMode = SnmpAccessMode.NotAccessible;
|
||||
}
|
||||
else
|
||||
{
|
||||
// not accessible or unsupported accress type
|
||||
return null;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static IEnumerable<IRestriction> CreateRestrictions(ValueRanges ranges)
|
||||
{
|
||||
List<IRestriction> result = new List<IRestriction>();
|
||||
|
||||
if (ranges != null)
|
||||
{
|
||||
foreach (ValueRange range in ranges)
|
||||
{
|
||||
if (!range.End.HasValue)
|
||||
{
|
||||
result.Add(new IsEqualRestriction(range.Start));
|
||||
}
|
||||
else
|
||||
{
|
||||
result.Add(new IsInRangeRestriction(range.Start, range.End.Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static IEnumerable<IRestriction> CreateRestrictions(ValueMap map)
|
||||
{
|
||||
if ((map != null) && (map.Count > 0))
|
||||
{
|
||||
return CreateRestrictions(map.GetContinousRanges());
|
||||
}
|
||||
|
||||
return new List<IRestriction>();
|
||||
}
|
||||
|
||||
private static IEnumerable<IRestriction> CreateRestrictions(BitsType bt)
|
||||
{
|
||||
List<IRestriction> result = new List<IRestriction>();
|
||||
|
||||
if ((bt != null) && (bt.Map != null))
|
||||
{
|
||||
result.Add(new BitMaskRestriction(bt.Map.GetBitMask()));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private static SnmpTableNode GenerateSnmpTableNode(MibTreeNode mibTreeNode, SnmpTreeNode parentNode)
|
||||
{
|
||||
SnmpTableNode result = new SnmpTableNode(parentNode);
|
||||
result.Name = mibTreeNode.Entity.Name;
|
||||
result.Oid = mibTreeNode.Entity.Value;
|
||||
|
||||
// expect exactly one row entry
|
||||
if ((mibTreeNode.ChildNodes.Count != 1) || ((mibTreeNode.ChildNodes[0].NodeType & MibTreeNodeType.TableRow) == 0) || (mibTreeNode.ChildNodes[0].Entity.Value != 1))
|
||||
{
|
||||
Console.WriteLine("Found table with unsupported properties! Table needs exactly one (fixed) TableRow with OID=1 ! (" + mibTreeNode.Entity.Name + ")");
|
||||
return null;
|
||||
}
|
||||
|
||||
MibTreeNode rowNode = mibTreeNode.ChildNodes[0];
|
||||
|
||||
ObjectType rot = rowNode.Entity as ObjectType;
|
||||
if (rot != null)
|
||||
{
|
||||
if (!String.IsNullOrWhiteSpace(rot.Augments))
|
||||
{
|
||||
result.AugmentedTableRow = rot.Augments;
|
||||
|
||||
// the indeces from another table shall be used because this table is only an extension of it
|
||||
rot = MibTypesResolver.ResolveDeclaration(rot.Module, rot.Augments) as ObjectType;
|
||||
}
|
||||
|
||||
if (rot.Indices != null)
|
||||
{
|
||||
foreach (string index in rot.Indices)
|
||||
{
|
||||
ObjectType indexEntity = MibTypesResolver.ResolveDeclaration(rot.Module, index) as ObjectType;
|
||||
if (indexEntity == null)
|
||||
{
|
||||
Console.WriteLine(String.Format("Could not resolve index '{0}' for table '{1}'! Table omitted!", index, result.Name));
|
||||
return null;
|
||||
}
|
||||
|
||||
result.IndexNodes.Add(GenerateSnmpScalarNode(indexEntity, parentNode, ignoreAccessibleFlag: true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result.IndexNodes.Count == 0)
|
||||
{
|
||||
// a table cannot be used without index
|
||||
Console.WriteLine("Found table without any index column ! (" + mibTreeNode.Entity.Name + ")");
|
||||
return null;
|
||||
}
|
||||
|
||||
// add child nodes
|
||||
foreach (MibTreeNode cellNode in rowNode.ChildNodes)
|
||||
{
|
||||
SnmpScalarNode ssn = GenerateSnmpScalarNode(cellNode, parentNode);
|
||||
if (ssn != null)
|
||||
{
|
||||
result.CellNodes.Add(ssn);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
// die mit einer Assembly verknüpft sind.
|
||||
[assembly: AssemblyTitle("ConsoleApplication28")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ConsoleApplication28")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
|
||||
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
|
||||
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
|
||||
[assembly: Guid("0abf7541-6a96-43cd-9e24-462e074b2c96")]
|
||||
|
||||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
//
|
||||
// Hauptversion
|
||||
// Nebenversion
|
||||
// Buildnummer
|
||||
// Revision
|
||||
//
|
||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
@@ -1,166 +0,0 @@
|
||||
namespace LwipMibViewer
|
||||
{
|
||||
partial class FormMain
|
||||
{
|
||||
/// <summary>
|
||||
/// Erforderliche Designervariable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Verwendete Ressourcen bereinigen.
|
||||
/// </summary>
|
||||
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Vom Windows Form-Designer generierter Code
|
||||
|
||||
/// <summary>
|
||||
/// Erforderliche Methode für die Designerunterstützung.
|
||||
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain));
|
||||
this.treeMib = new System.Windows.Forms.TreeView();
|
||||
this.imagelistTreeNodeImages = new System.Windows.Forms.ImageList(this.components);
|
||||
this.splitContainerMain = new System.Windows.Forms.SplitContainer();
|
||||
this.listviewNodeDetails = new System.Windows.Forms.ListView();
|
||||
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.toolStripMain = new System.Windows.Forms.ToolStrip();
|
||||
this.toolbuttonOpenMib = new System.Windows.Forms.ToolStripButton();
|
||||
this.dialogOpenMib = new System.Windows.Forms.OpenFileDialog();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainerMain)).BeginInit();
|
||||
this.splitContainerMain.Panel1.SuspendLayout();
|
||||
this.splitContainerMain.Panel2.SuspendLayout();
|
||||
this.splitContainerMain.SuspendLayout();
|
||||
this.toolStripMain.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// treeMib
|
||||
//
|
||||
this.treeMib.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.treeMib.ImageIndex = 0;
|
||||
this.treeMib.ImageList = this.imagelistTreeNodeImages;
|
||||
this.treeMib.Location = new System.Drawing.Point(0, 0);
|
||||
this.treeMib.Name = "treeMib";
|
||||
this.treeMib.SelectedImageIndex = 0;
|
||||
this.treeMib.Size = new System.Drawing.Size(1028, 418);
|
||||
this.treeMib.TabIndex = 0;
|
||||
this.treeMib.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.treeMib_AfterSelect);
|
||||
//
|
||||
// imagelistTreeNodeImages
|
||||
//
|
||||
this.imagelistTreeNodeImages.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imagelistTreeNodeImages.ImageStream")));
|
||||
this.imagelistTreeNodeImages.TransparentColor = System.Drawing.Color.Transparent;
|
||||
this.imagelistTreeNodeImages.Images.SetKeyName(0, "ntimgContainer");
|
||||
this.imagelistTreeNodeImages.Images.SetKeyName(1, "ntimgTable");
|
||||
this.imagelistTreeNodeImages.Images.SetKeyName(2, "ntimgRow");
|
||||
this.imagelistTreeNodeImages.Images.SetKeyName(3, "ntimgColumn");
|
||||
this.imagelistTreeNodeImages.Images.SetKeyName(4, "ntimgScalar");
|
||||
this.imagelistTreeNodeImages.Images.SetKeyName(5, "ntimgUnknown");
|
||||
//
|
||||
// splitContainerMain
|
||||
//
|
||||
this.splitContainerMain.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.splitContainerMain.Location = new System.Drawing.Point(0, 25);
|
||||
this.splitContainerMain.Name = "splitContainerMain";
|
||||
this.splitContainerMain.Orientation = System.Windows.Forms.Orientation.Horizontal;
|
||||
//
|
||||
// splitContainerMain.Panel1
|
||||
//
|
||||
this.splitContainerMain.Panel1.Controls.Add(this.treeMib);
|
||||
//
|
||||
// splitContainerMain.Panel2
|
||||
//
|
||||
this.splitContainerMain.Panel2.Controls.Add(this.listviewNodeDetails);
|
||||
this.splitContainerMain.Size = new System.Drawing.Size(1028, 625);
|
||||
this.splitContainerMain.SplitterDistance = 418;
|
||||
this.splitContainerMain.TabIndex = 1;
|
||||
//
|
||||
// listviewNodeDetails
|
||||
//
|
||||
this.listviewNodeDetails.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.columnHeader1,
|
||||
this.columnHeader2});
|
||||
this.listviewNodeDetails.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.listviewNodeDetails.FullRowSelect = true;
|
||||
this.listviewNodeDetails.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
|
||||
this.listviewNodeDetails.Location = new System.Drawing.Point(0, 0);
|
||||
this.listviewNodeDetails.Name = "listviewNodeDetails";
|
||||
this.listviewNodeDetails.Size = new System.Drawing.Size(1028, 203);
|
||||
this.listviewNodeDetails.TabIndex = 0;
|
||||
this.listviewNodeDetails.UseCompatibleStateImageBehavior = false;
|
||||
this.listviewNodeDetails.View = System.Windows.Forms.View.Details;
|
||||
//
|
||||
// columnHeader1
|
||||
//
|
||||
this.columnHeader1.Text = "";
|
||||
this.columnHeader1.Width = 150;
|
||||
//
|
||||
// columnHeader2
|
||||
//
|
||||
this.columnHeader2.Text = "";
|
||||
this.columnHeader2.Width = 777;
|
||||
//
|
||||
// toolStripMain
|
||||
//
|
||||
this.toolStripMain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolbuttonOpenMib});
|
||||
this.toolStripMain.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStripMain.Name = "toolStripMain";
|
||||
this.toolStripMain.Size = new System.Drawing.Size(1028, 25);
|
||||
this.toolStripMain.TabIndex = 2;
|
||||
//
|
||||
// toolbuttonOpenMib
|
||||
//
|
||||
this.toolbuttonOpenMib.Image = ((System.Drawing.Image)(resources.GetObject("toolbuttonOpenMib.Image")));
|
||||
this.toolbuttonOpenMib.Name = "toolbuttonOpenMib";
|
||||
this.toolbuttonOpenMib.Size = new System.Drawing.Size(65, 22);
|
||||
this.toolbuttonOpenMib.Text = "Open...";
|
||||
this.toolbuttonOpenMib.Click += new System.EventHandler(this.toolbuttonOpenMib_Click);
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1028, 650);
|
||||
this.Controls.Add(this.splitContainerMain);
|
||||
this.Controls.Add(this.toolStripMain);
|
||||
this.Name = "FormMain";
|
||||
this.Text = "MIB Viewer";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
this.splitContainerMain.Panel1.ResumeLayout(false);
|
||||
this.splitContainerMain.Panel2.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainerMain)).EndInit();
|
||||
this.splitContainerMain.ResumeLayout(false);
|
||||
this.toolStripMain.ResumeLayout(false);
|
||||
this.toolStripMain.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TreeView treeMib;
|
||||
private System.Windows.Forms.SplitContainer splitContainerMain;
|
||||
private System.Windows.Forms.ListView listviewNodeDetails;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader1;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader2;
|
||||
private System.Windows.Forms.ImageList imagelistTreeNodeImages;
|
||||
private System.Windows.Forms.ToolStrip toolStripMain;
|
||||
private System.Windows.Forms.ToolStripButton toolbuttonOpenMib;
|
||||
private System.Windows.Forms.OpenFileDialog dialogOpenMib;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,217 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System.Windows.Forms;
|
||||
using Lextm.SharpSnmpLib.Mib;
|
||||
using Lextm.SharpSnmpLib.Mib.Elements;
|
||||
using Lextm.SharpSnmpLib.Mib.Elements.Types;
|
||||
using Lextm.SharpSnmpLib.Mib.Elements.Entities;
|
||||
using System.IO;
|
||||
|
||||
namespace LwipMibViewer
|
||||
{
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
readonly ListViewGroup listviewgroupAbstract;
|
||||
readonly ListViewGroup listviewgroupElement;
|
||||
readonly ListViewGroup listviewgroupBaseType;
|
||||
readonly ListViewGroup listviewgroupTypeChain;
|
||||
|
||||
public FormMain()
|
||||
{
|
||||
this.Font = SystemInformation.MenuFont;
|
||||
InitializeComponent();
|
||||
|
||||
this.listviewgroupAbstract = new ListViewGroup("Abstract", System.Windows.Forms.HorizontalAlignment.Left);
|
||||
this.listviewgroupElement = new ListViewGroup("Element Properties", System.Windows.Forms.HorizontalAlignment.Left);
|
||||
this.listviewgroupBaseType = new ListViewGroup("Element Base Type", System.Windows.Forms.HorizontalAlignment.Left);
|
||||
this.listviewgroupTypeChain = new ListViewGroup("Element Type Chain", System.Windows.Forms.HorizontalAlignment.Left);
|
||||
this.listviewNodeDetails.Groups.AddRange(new System.Windows.Forms.ListViewGroup[] {
|
||||
listviewgroupAbstract,
|
||||
listviewgroupElement,
|
||||
listviewgroupBaseType,
|
||||
listviewgroupTypeChain});
|
||||
|
||||
try
|
||||
{
|
||||
DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(Application.ExecutablePath));
|
||||
if (dirInfo != null)
|
||||
{
|
||||
dirInfo = dirInfo.Parent;
|
||||
if (dirInfo != null)
|
||||
{
|
||||
dirInfo = dirInfo.Parent;
|
||||
if (dirInfo != null)
|
||||
{
|
||||
dirInfo = new DirectoryInfo(Path.Combine(dirInfo.FullName, "Mibs"));
|
||||
if (dirInfo.Exists)
|
||||
{
|
||||
MibTypesResolver.RegisterResolver(new FileSystemMibResolver(dirInfo.FullName, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
|
||||
#region GUI Event Handler
|
||||
|
||||
private void toolbuttonOpenMib_Click(object sender, System.EventArgs e)
|
||||
{
|
||||
if (this.dialogOpenMib.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
OpenMib(this.dialogOpenMib.FileName);
|
||||
}
|
||||
}
|
||||
|
||||
private void treeMib_AfterSelect(object sender, TreeViewEventArgs e)
|
||||
{
|
||||
listviewNodeDetails.Items.Clear();
|
||||
|
||||
if (e.Node != null)
|
||||
{
|
||||
MibTreeNode mtn = e.Node.Tag as MibTreeNode;
|
||||
if (mtn != null)
|
||||
{
|
||||
listviewNodeDetails.Items.Add(new ListViewItem(new string[] { "Abstract", mtn.NodeType.ToString() }, this.listviewgroupAbstract));
|
||||
|
||||
listviewNodeDetails.Items.Add(new ListViewItem(new string[] { "Module", (mtn.Entity.Module != null) ? mtn.Entity.Module.Name : "" }, this.listviewgroupElement));
|
||||
listviewNodeDetails.Items.Add(new ListViewItem(new string[] { "Type", mtn.Entity.GetType().Name }, this.listviewgroupElement));
|
||||
listviewNodeDetails.Items.Add(new ListViewItem(new string[] { "Name", mtn.Entity.Name }, this.listviewgroupElement));
|
||||
listviewNodeDetails.Items.Add(new ListViewItem(new string[] { "Description", mtn.Entity.Description }, this.listviewgroupElement));
|
||||
listviewNodeDetails.Items.Add(new ListViewItem(new string[] { "OID", mtn.Entity.Value.ToString() }, this.listviewgroupElement));
|
||||
listviewNodeDetails.Items.Add(new ListViewItem(new string[] { "Full OID", MibTypesResolver.ResolveOid(mtn.Entity).GetOidString() }, this.listviewgroupElement));
|
||||
if (mtn.Entity is ObjectType)
|
||||
{
|
||||
listviewNodeDetails.Items.Add(new ListViewItem(new string[] { "Access", (mtn.Entity as ObjectType).Access.ToString() }, this.listviewgroupElement));
|
||||
}
|
||||
|
||||
ITypeReferrer tr = mtn.Entity as ITypeReferrer;
|
||||
if (tr != null)
|
||||
{
|
||||
ShowTypeDetails(listviewNodeDetails, this.listviewgroupBaseType, tr.BaseType);
|
||||
ShowTypeChain(listviewNodeDetails, tr.ReferredType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
private void OpenMib(string file)
|
||||
{
|
||||
try
|
||||
{
|
||||
MibDocument md = new MibDocument(file);
|
||||
MibTypesResolver.ResolveTypes(md.Modules[0]);
|
||||
|
||||
this.treeMib.Nodes.Clear();
|
||||
this.listviewNodeDetails.Items.Clear();
|
||||
|
||||
MibTree mt = new MibTree(md.Modules[0] as MibModule);
|
||||
foreach (MibTreeNode mibTreeNode in mt.Root)
|
||||
{
|
||||
AddNode(mibTreeNode, this.treeMib.Nodes);
|
||||
|
||||
foreach (TreeNode node in this.treeMib.Nodes)
|
||||
{
|
||||
node.Expand();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void AddNode(MibTreeNode mibNode, TreeNodeCollection parentNodes)
|
||||
{
|
||||
int imgIndex = 5; //unknown
|
||||
if ((mibNode.NodeType & MibTreeNodeType.Table) != 0)
|
||||
{
|
||||
imgIndex = 1;
|
||||
}
|
||||
else if ((mibNode.NodeType & MibTreeNodeType.TableRow) != 0)
|
||||
{
|
||||
imgIndex = 2;
|
||||
}
|
||||
else if ((mibNode.NodeType & MibTreeNodeType.TableCell) != 0)
|
||||
{
|
||||
imgIndex = 3;
|
||||
}
|
||||
else if ((mibNode.NodeType & MibTreeNodeType.Scalar) != 0)
|
||||
{
|
||||
imgIndex = 4;
|
||||
}
|
||||
else if ((mibNode.NodeType & MibTreeNodeType.Container) != 0)
|
||||
{
|
||||
imgIndex = 0;
|
||||
}
|
||||
|
||||
TreeNode newNode = new TreeNode(mibNode.Entity.Name, imgIndex, imgIndex);
|
||||
newNode.Tag = mibNode;
|
||||
|
||||
parentNodes.Add(newNode);
|
||||
|
||||
foreach (MibTreeNode child in mibNode.ChildNodes)
|
||||
{
|
||||
AddNode(child, newNode.Nodes);
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowTypeChain(ListView lv, ITypeAssignment type)
|
||||
{
|
||||
ShowTypeDetails(lv, this.listviewgroupTypeChain, type);
|
||||
|
||||
ITypeReferrer tr = type as ITypeReferrer;
|
||||
if ((tr != null) && (tr.ReferredType != null))
|
||||
{
|
||||
lv.Items.Add(new ListViewItem(new string[] { " >>>", "" }, this.listviewgroupTypeChain));
|
||||
ShowTypeChain(listviewNodeDetails, tr.ReferredType);
|
||||
}
|
||||
}
|
||||
|
||||
private void ShowTypeDetails(ListView lv, ListViewGroup lvg, ITypeAssignment type)
|
||||
{
|
||||
lv.Items.Add(new ListViewItem(new string[] { "Module", (type.Module != null) ? type.Module.Name : "" }, lvg));
|
||||
lv.Items.Add(new ListViewItem(new string[] { "Type", type.GetType().Name }, lvg));
|
||||
lv.Items.Add(new ListViewItem(new string[] { "Name", type.Name }, lvg));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,298 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="imagelistTreeNodeImages.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="imagelistTreeNodeImages.ImageStream" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>
|
||||
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
|
||||
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
|
||||
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABo
|
||||
IQAAAk1TRnQBSQFMAgEBBgEAARABAAEQAQABEAEAARABAAT/ASEBAAj/AUIBTQE2BwABNgMAASgDAAFA
|
||||
AwABIAMAAQEBAAEgBgABIBIAAwQBBQMWAR4DIgEyAzEBTwJGAUQBhwMvAUsDHgErAxsBJgMYASIDFQEd
|
||||
AxIBGAMNARIDCgENAwcBCQMEAQUDAQECAwQBBQMWAR4DIgEyAzEBTgJGAUQBhwMvAUsDHgErAxsBJgMb
|
||||
ASYDIQExAyEBMAMdASoDGwEmAxgBIQMLAQ8DAQECgAADAgEDAwwBEAMrAUMCRgFEAYIC/wHwAf8CRgFE
|
||||
AYIDKgFAAw8BFAMNAREDCwEPAwkBDAMHAQoDBQEHAwQBBQMCAQMDAAEBAwIBAwMLAQ8DKwFDAkYBRAGC
|
||||
Av8B8AH/AkYBRAGCAyoBQAMOARMDEgEZAT0COwFpAVwBRQFCAawBZwE+AToBxAFaAUUBQwGqATwBOwE6
|
||||
AWYDEAEWAwABAYQAAx4BKwJEAUIBewL/AfAB/wLpAdoD/wHxAf8CRAFCAXsDHgErJAADHgErAkQBQgF7
|
||||
Av8B8AH/AukB2gP/AfEB/wJEAUIBewMeASsBLgItAUcBdwFHATwByQG7AVQBPQHxA+4B/wG7AVMBPAHx
|
||||
AXcBRgE8AckBLgItAUeEAAMdASoCRAFCAXcC/wHwAf8B6wHdAbEB/wH3AcEBNwH/Ae0B3wGzA/8B8gH/
|
||||
AkQBQgF3Ax0BKhwAAx0BKgJEAUIBdwL/AfAB/wLpAdoB/wLqAdwB/wLrAd4D/wHyAf8CRAFCAXcBZAFJ
|
||||
AUIBrwG2AVkBQQHxAc0BVAEyAf8BvQF5AWIB/wHFAVABLgH/AbEBUQE1AfEBXAFIAUQBn4QAAkMBQQF2
|
||||
Av8B8AH/AukB2gH/AecBqwEhAf8B5wGrASEB/wHnAasBIQH/AeoB2wGwA/8B9AH/AkMBQQF2Ax0BKhgA
|
||||
AkMBQQF2Av8B8AH/AukB2gH/AuoB3AH/AusB3gH/AuwB3wH/Au0B4QP/AfQB/wGAAUQBMQHaAc4BcAFN
|
||||
AfwBugFMASoB/wPSAf8BvgGLAXgB/wG7AVIBMgH8AW8BSQE/AbqEAAMdASkCQwFBAXQC/wHxAf8B5wHX
|
||||
AasB/wHXAZYBDAH/AdcBlgEMAf8B1wGWAQwB/wHoAdgBrgP/AfUB/wJDAUEBdAMdASkUAAMdASkCQwFB
|
||||
AXQC/wHxAf8C6wHeAf8C7AHfAf8C7QHhAf8C7gHjAf8C7wHlAf8BzQF5AV4B/wHOAXcBWAH3AbwBVAEy
|
||||
Af8BtAFMASoB/wPmAf8BtwFlAUsB8AFdAUkBRAGdiAADHQEpAkIBQQFyAv8B8gH/AeUB1AGpAf8BzQGJ
|
||||
AQAB/wHNAYkBAAH/Ac0BiQEAAf8B6AHXAa8D/wH3Af8CQgFBAXIDHAEoFAADHQEpAkIBQQFyAv8B8gH/
|
||||
Au0B4QH/Au4B4wH/Au8B5QH/AvAB5wH/AeABuwGqAf8BzgFpAUgB/wHjAcsBwQH5BP8B3gHHAb0B9QF+
|
||||
AU8BQgHEAi0BLAFFjAADHAEoAkEBQAFxAv8B9AH/AecB1gGsAf8B0QGOAQQB/wHRAY4BBAH/AdEBjgEE
|
||||
Af8B7AHbAbMD/wH4Af8CQQFAAXEDHAEoFAADHAEoAkEBQAFxAv8B9AH/Au8B5QH/AvAB5wH/AvEB6QH/
|
||||
AvMB6gH/AeQBvgGsAf8B1AGBAWIB/wGGAUoBNAHXAWYBTQFEAaoCLQEsAUWUAAMcAScCQQFAAW8C/wH1
|
||||
Af8B7AHcAbMB/wHfAaEBFwH/Ad8BoQEXAf8B3wGhARcB/wHxAeIBuwP/AfoB/wJBAUABbwMcAScUAAMc
|
||||
AScCQQFAAW8C/wH1Af8C8QHpAf8C8wHqAf8C9AHsAf8C9QHuAf8C9gHwA/8B+gH/AkEBQAFvAxwBJ5gA
|
||||
AxwBJwJAAT8BbQL/AfcB/wHyAeMBuwH/AfABuAEuAf8B8AG4AS4B/wHwAbgBLgH/AvgB9AP/AfsB/wJA
|
||||
AT8BbQMcAScUAAMcAScCQAE/AW0C/wH3Af8C9AHsAf8C9QHuAf8C9gHwAf8C9wHyAf8C+AH0A/8B+wH/
|
||||
AkABPwFtAxwBJ5gAAxsBJgJAAT8BbAL/AfgB/wH3AeoBwwH/Af0ByQE/Af8B+QHsAccB/wL7AfcB/wL8
|
||||
AfkD/wH8Af8CQAE/AWwDGwEmFAADGwEmAkABPwFsAv8B+AH/AvYB8AH/AvcB8gH/AvgB9AH/AvsB9wH/
|
||||
AvwB+QP/AfwB/wJAAT8BbAMbASaYAAMbASYCPwE+AWsC/wH6Af8C+AH0Af8C+wH3Af8C3wHVAf8CyQG5
|
||||
Af8C4AHWA/8B/gH/Aj8BPgFrGAADGwEmAj8BPgFrAv8B+gH/AvgB9AH/AvsB9wH/At8B1QH/AskBuQH/
|
||||
AuAB1gP/Af4B/wI/AT4Ba5wAAxoBJQI/AT0BaQL/AfsB/wL8AfkB/wK8AawB/wQAArwBrAP/Af4B/wI/
|
||||
AT0BaRwAAxoBJQI/AT0BaQL/AfsB/wL8AfkB/wK8AawB/wQAArwBrAP/Af4B/wI/AT0BaaAAAxoBJQI+
|
||||
AT0BaAL/AfwB/wLLAcEB/wKgAZAB/wLLAcED/wH+Af8CPgE9AWggAAMaASUCPgE9AWgC/wH8Af8CywHB
|
||||
Af8CoAGQAf8CywHBA/8B/gH/Aj4BPQFopAADGgElAj4BPQFnAv8B/gP/Af4D/wH+Bf8CPgE9AWckAAMa
|
||||
ASUCPgE9AWcC/wH+A/8B/gP/Af4F/wI+AT0BZ6gAAxoBJAI+AT0BZgI+AT0BZgI+AT0BZgI+AT0BZgMx
|
||||
AU0oAAMaASQCPgE9AWYCPgE9AWYCPgE9AWYCPgE9AWYDMQFNlAADIQEwAUABRgFIAXwBQwFOAVIBkgMF
|
||||
AQccAAMHAQkDEAEWAxMBGgMTARoDEwEaAxMBGgMTARoDEwEaAxMBGgMTARoDEwEaAxMBGgMTARoDEwEa
|
||||
AxABFgMHAQkDBwEJAxABFgMTARoDEwEaAxMBGgMTARoDEwEaAxMBGgMTARoDEwEaAxMBGgMTARoDEwEa
|
||||
AxMBGgMQARYDBwEJAwcBCQMQARYDEwEaAxMBGgMTARoDEwEaAxMBGgMTARoDEwEaAxMBGgMTARoDEwEa
|
||||
AxMBGgMTARoDEAEWAwcBCQwAAjIBMwFQAUMBUQFXAZkBRQFkAXQBwAFYAYsBogHgATwBWAFqAcEDEwEa
|
||||
AwUBBxgAAjwBOwFpAkYBRAGHAkYBRAGHAkYBRAGHAkYBRAGHAkYBRAGHAkYBRAGHAkYBRAGHAkYBRAGH
|
||||
AkYBRAGHAkYBRAGHAkYBRAGHAkYBRAGHAkYBRAGHAkYBRAGHAjwBOwFpAjkBNAFpAkABNwGHAkABNwGH
|
||||
AkABNwGHAkABNwGHAkABNwGHAkABNwGHAkABNwGHAkABNwGHAkABNwGHAkABNwGHAkABNwGHAkABNwGH
|
||||
AkABNwGHAkABNwGHAjkBNAFpAjwBOwFpAkYBRAGHAkYBRAGHAkYBRAGHAkYBRAGHAkYBRAGHAkYBRAGH
|
||||
AkYBRAGHAkYBRAGHAkYBRAGHAkYBRAGHAkYBRAGHAkYBRAGHAkYBRAGHAkYBRAGHAjwBOwFpAw0BEQMa
|
||||
ASQBRAFNAVEBmAE8AYkBrAHyAWcBrwHTAfoBggHLAewB/wGFAc4B7gH/ARUBWwGCAe8BOgFXAWYBxAE6
|
||||
AVcBZgHEAT4BWgFqAb4BPgFaAWoBvgE+AVoBagG+AUQBTQFRAZgDGgEkAw0BEQJGAUMBgQL5AekB/wLz
|
||||
AeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLz
|
||||
AeIB/wLzAeIB/wL5AekB/wJGAUMBgQJDAToBgQL5AekB/wLzAeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLz
|
||||
AeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLzAeIB/wL5AekB/wJDAToBgQJG
|
||||
AUMBgQL5AekB/wLzAeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLzAeIB/wLz
|
||||
AeIB/wLzAeIB/wLzAeIB/wLzAeIB/wL5AekB/wJGAUMBgQMHAQkDDQESAUIBWwFmAbIBiAHQAe8B/wF9
|
||||
AcoB6QH/AX0BygHpAf8BhwHQAe8B/wEkAXsBqQH/AX0BvAHbAf8BfQG8AdsB/wGNAdEB8wH/AY0B0QHz
|
||||
Af8BkAHUAfUB/wFCAVsBZgGyATACMQFNAwcBCQJEAUMBegL0AeQC/wHMAUIB/wH+AcsBQQH/AewB0gGG
|
||||
Af8C2gHJAf8C2AHHAf8C1gHFAf8C1AHDAf8C0wHCAf8C0QHAAf8CzwG+Af8CzgG9Af8CzQG8Af8C9AHk
|
||||
Af8CRAFDAXoCRgE+AXoC9AHkAv8BzAFDAf8B/gHLAUIB/wHsAdIBhgH/AtoByQH/AtgBxwH/AtYBxQH/
|
||||
AtQBwwH/AtMBwgH/AtEBwAH/As8BvgH/As4BvQH/As0BvAH/AvQB5AH/AkYBPgF6AkQBQwF6AvQB5AL/
|
||||
AcwBQgH/Af4BywFBAf8B7AHSAYYB/wLaAckB/wLYAccB/wHnAWEBPwH/AecBYQE/Af8B5wFhAT8B/wHn
|
||||
AWEBPwH/As8BvgH/As4BvQH/As0BvAH/AvQB5AH/AkQBQwF6CAABQwFXAWABpAGKAdMB8AH/AYIBzQHr
|
||||
Af8BggHNAesB/wGKAdMB8AH/ASQBfAGrAf8BegG5AdgB/wF6AbkB2AH/AYoBzgHwAf8BigHOAfAB/wGP
|
||||
AdMB9AH/AfQBtgEsAf8BQwFXAWABpAQAAkQBQgF3AvUB5gL/AcwBQgL/Ae4BiAH/AewB0gGGAf8C9QHu
|
||||
Af8C9QHuAf8C1gHFAf8C9QHuAf8C9QHuAf8C0QHAAf8C9QHuAf8C9QHuAf8CzQG8Af8C9QHmAf8CRAFC
|
||||
AXcCRwE/AXcC9QHmAv8BzAFDAv8B7gGIAf8B7AHSAYYB/wL1Ae4B/wL1Ae4B/wLWAcUB/wL1Ae4B/wL1
|
||||
Ae4B/wLRAcAB/wL1Ae4B/wL1Ae4B/wLNAbwB/wL1AeYB/wJHAT8BdwJEAUIBdwL1AeYC/wHMAUIC/wHu
|
||||
AYgB/wHsAdIBhgH/AvUB7gH/AvUB7gH/AdkBWAE2Af8B8gHJAbgB/wHyAckBuAH/AdkBWAE2Af8C9QHu
|
||||
Af8C9QHuAf8CzQG8Af8C9QHmAf8CRAFCAXcIAAFDAVUBXgGeAY4B1gHyAf8BhwHQAe0B/wGHAdAB7QH/
|
||||
AY4B1gHyAf8BJgGCAa8B/wF7AboB2AH/AXsBugHYAf8BiwHPAfEB/wGLAc8B8QH/AZEB1QH1Af8B/gHJ
|
||||
AT8B/wFDAVUBXgGeBAACQwFBAXUC9gHpAv8BzAFCAf8B/gHLAUEB/wHsAdIBhgH/AtoByQH/AtgBxwH/
|
||||
AtwBzAH/AtQBwwH/AtMBwgH/AtgByAH/As8BvgH/As4BvQH/As0BvAH/AvYB6QH/AkMBQQF1AkcBPwF1
|
||||
AvYB6QL/AcwBQwH/Af4BywFCAf8B7AHSAYYB/wLaAckB/wLYAccB/wLcAcwB/wLUAcMB/wLTAcIB/wLY
|
||||
AcgB/wLPAb4B/wLOAb0B/wLNAbwB/wL2AekB/wJHAT8BdQJDAUEBdQL2AekC/wHMAUIB/wH+AcsBQQH/
|
||||
AewB0gGGAf8C2gHJAf8C2AHHAf8ByAFPAS0B/wHeAbYBngH/Ad4BtQGdAf8ByAFPAS0B/wLPAb4B/wLO
|
||||
Ab0B/wLNAbwB/wL2AekB/wJDAUEBdQgAAUQBVQFdAZsBkgHaAfQB/wGLAdQB8AH/AYsB1AHwAf8BkgHa
|
||||
AfQB/wEpAYUBswH/AX0BvAHaAf8BfQG8AdoB/wGNAdEB8wH/AY0B0QHzAf8BkwHXAfYB/wLrAd0B/wFE
|
||||
AVUBXQGbBAACQgFBAXMC9wHrAv8BzAFCAv8B7gGIAf8B7AHSAYYB/wL3AfEB/wL3AfEB/wLWAcUB/wL3
|
||||
AfEB/wL3AfEB/wLRAcAB/wL3AfEB/wL3AfEB/wLNAbwB/wL3AesB/wJCAUEBcwJHAT8BcwL3AesC/wHM
|
||||
AUMC/wHuAYgB/wHsAdIBhgH/AvcB8QH/AvcB8QH/AtYBxQH/AvcB8QH/AvcB8QH/AtEBwAH/AvcB8QH/
|
||||
AvcB8QH/As0BvAH/AvcB6wH/AkcBPwFzAkIBQQFzAvcB6wL/AcwBQgL/Ae4BiAH/AewB0gGGAf8C9wHx
|
||||
Af8C9wHxAf8BuAFHASUB/wHzAcsBuQH/AfMBywG5Af8BuAFHASUB/wL3AfEB/wL3AfEB/wLNAbwB/wL3
|
||||
AesB/wJCAUEBcwgAAUQBUwFbApcB3gH2Af8BkAHYAfIB/wGQAdgB8gH/AZcB3gH2Af8BKwGJAbcB/wGA
|
||||
Ab0B3AH/AYABvQHcAf8BjwHTAfUB/wGPAdMB9QH/AZUB2QH4Af8C9QHuAf8BRAFTAVsBlwQAAkIBQQFy
|
||||
AvgB7gL/AcwBQgH/Af4BywFBAf8B7AHSAYYB/wLaAckB/wLYAccB/wLdAc4B/wLUAcMB/wLTAcIB/wLZ
|
||||
AcoB/wLPAb4B/wLOAb0B/wLNAbwB/wL4Ae4B/wJCAUEBcgJIAUABcgL4Ae4B/wHsAYYBYwH/AeIBewFZ
|
||||
Af8B1AFuAUwB/wHEAWABPgH/AbYBUgEwAf8BrQFHASUB/wGrAUMBIQH/AbEBRAEiAf8BvQFKASgB/wHM
|
||||
AVIBMAH/AdsBWgE4Af8B6AFiAUAB/wL4Ae4B/wJIAUABcgJCAUEBcgL4Ae4C/wHMAUIB/wH+AcsBQQH/
|
||||
AewB0gGGAf8C2gHJAf8C2AHHAf8BrQFCASAB/wHeAbYBngH/Ad4BtQGdAf8BrQFCASAB/wLPAb4B/wLO
|
||||
Ab0B/wLNAbwB/wL4Ae4B/wJCAUEBcggAAUQBUwFaAZQBmwHhAfcB/wGUAdsB9AH/AZQB2wH0Af8BmwHh
|
||||
AfcB/wEuAY0BvAH/AYEBvgHdAf8BgQG+Ad0B/wGQAdQB9gH/AZAB1AH2Af8BlwHbAfkB/wL+Af0B/wFE
|
||||
AVMBWgGUBAACQQFAAXAC+QHxAv8BzAFCAv8B7gGIAf8B7AHSAYYB/wL5AfUB/wL5AfUB/wLWAcUB/wL5
|
||||
AfUB/wL5AfUB/wLRAcAB/wL5AfUB/wL5AfUB/wLNAbwB/wL5AfEB/wJBAUABcAJHAUABcAL5AfEB/wHs
|
||||
AYYBYwH/AfgBxQF5Af8B7QG1AXgB/wH1AcwBvAH/AfUBzAG8Af8B4AG3AZ8B/wH1AcwBvAH/AfUBzAG8
|
||||
Af8B3QG0AZwB/wH1AcwBvAH/AfUBzAG8Af8B6AFiAUAB/wL5AfEB/wJHAUABcAJBAUABcAL5AfEC/wHM
|
||||
AUIC/wHuAYgB/wHsAdIBhgH/AvkB9QH/AvkB9QH/AasBRAEiAf8B9QHMAbwB/wH1AcwBvAH/AasBRAEi
|
||||
Af8C+QH1Af8C+QH1Af8CzQG8Af8C+QHxAf8CQQFAAXAIAAFEAVEBVwGQAZ4B5QH5Af8BmAHfAfYB/wGY
|
||||
Ad8B9gH/AZ4B5QH5Af8BMAGQAcAB/wGDAcAB3wH/AYMBwAHfAf8BkgHWAfgB/wGSAdYB+AH/AZkB3QH6
|
||||
Af8BRAFRAVcBkAMjATMEAAJBAUABbgL7AfQC/wHMAUIB/wH+AcsBQQH/AewB0gGGAf8C2gHJAf8C2AHH
|
||||
Af8C3gHQAf8C1AHDAf8C0wHCAf8C2gHMAf8CzwG+Af8CzgG9Af8CzQG8Af8C+wH0Af8CQQFAAW4CRwFA
|
||||
AW4C+wH0Af8B7AGGAWMB/wHiAXsBWQH/AdQBbgFMAf8BxAFgAT4B/wG2AVIBMAH/Aa0BRwElAf8BqwFD
|
||||
ASEB/wGxAUQBIgH/Ab0BSgEoAf8BzAFSATAB/wHbAVoBOAH/AegBYgFAAf8C+wH0Af8CRwFAAW4CQQFA
|
||||
AW4C+wH0Av8BzAFCAf8B/gHLAUEB/wHsAdIBhgH/AtoByQH/AtgBxwH/AbIBTAEqAf8B3gG2AZ4B/wHe
|
||||
AbUBnQH/AbIBTAEqAf8CzwG+Af8CzgG9Af8CzQG8Af8C+wH0Af8CQQFAAW4IAAFDAU8BVQGNAaMB6AH7
|
||||
Af8BnQHjAfkB/wGdAeMB+QH/AaMB6AH7Af8BMwGUAcUB/wGFAcIB4QH/AYUBwgHhAf8BlAHYAfoB/wGU
|
||||
AdgB+gH/AZsB3wH8Af8BQwFPAVUBjQgAAkABPwFtAvwB9wL/AcwBQgL/Ae4BiAH/AewB0gGGAf8C/AH6
|
||||
Af8C/AH6Af8C1gHFAf8C/AH6Af8C/AH6Af8C0QHAAf8C/AH6Af8C/AH6Af8CzQG8Af8C/AH3Af8CQAE/
|
||||
AW0CRwFAAW0C/AH3Av8BzAFDAv8B7gGIAf8B7AHSAYYB/wL8AfoB/wL8AfoB/wLWAcUB/wL8AfoB/wL8
|
||||
AfoB/wLRAcAB/wL8AfoB/wL8AfoB/wLNAbwB/wL8AfcB/wJHAUABbQJAAT8BbQL8AfcC/wHMAUIC/wHu
|
||||
AYgB/wHsAdIBhgH/AvwB+gH/AvwB+gH/AcABWgE4Af8B9gHOAb8B/wH2Ac4BvwH/AcABWgE4Af8C/AH6
|
||||
Af8C/AH6Af8CzQG8Af8C/AH3Af8CQAE/AW0IAAFDAU8BVAGKAaYB6wH8Af8BoQHmAfsB/wGhAeYB+wH/
|
||||
AaYB6wH8Af8BOgGdAc8B/wGHAcQB4gH/AYcBxAHiAf8BlgHaAfwB/wGWAdoB/AH/AZ4B4gH9Af8BQwFP
|
||||
AVQBiggAAj8BPgFrAv0B+QL/AcwBQgH/Af4BywFBAf8B9QHOAWIB/wHrAdIBhQH/AekB0AGDAf8B5wHO
|
||||
AYEB/wHlAcwBgAH/AeQBywF8Af8B4gHJAXoB/wHgAccBeAH/Ad8BxgF3Af8B3gHFAXYB/wL9AfkB/wI/
|
||||
AT4BawJHAUABawL9AfkC/wHMAUMB/wH+AcsBQgH/AfUBzgFjAf8B6wHSAYUB/wHpAdABgwH/AecBzgGB
|
||||
Af8B5QHMAYAB/wHkAcsBfQH/AeIByQF7Af8B4AHHAXkB/wHfAcYBeAH/Ad4BxQF3Af8C/QH5Af8CRwFA
|
||||
AWsCPwE+AWsC/QH5Av8BzAFCAf8B/gHLAUEB/wH1Ac4BYgH/AesB0gGFAf8B6QHQAYMB/wHRAWoBSAH/
|
||||
AekBsQF0Af8B6AGwAXMB/wHRAWoBSAH/AeABxwF4Af8B3wHGAXcB/wHeAcUBdgH/Av0B+QH/Aj8BPgFr
|
||||
CAABQgFNAVIBhwGpAe4B/QH/AaQB6QH8Af8BpAHpAfwB/wGqAe8B/QH/AUABoQHRAf8BkAHRAfEB/wGW
|
||||
AdoB+wH/AZcB2wH9Af8BlwHbAf0B/wGfAeMB/gH/AUIBTQFSAYcIAAI/AT4BagL+AfwC/wHMAUIC/wHu
|
||||
AYgB/wH9AcoBQAH/AfwB6wGFAf8B+wHqAYQB/wH4AcUBOwH/AfYB5QF9Af8B9AHjAXsB/wHzAcABNgH/
|
||||
AfEB4AF4Af8B7wHeAXYB/wHvAbwBMgH/Av4B/AH/Aj8BPgFqAkcBQAFqAv4B/AL/AcwBQwL/Ae4BiAH/
|
||||
Af0BygFBAf8B/AHrAYUB/wH7AeoBhAH/AfgBxQE8Af8B9gHlAX4B/wH0AeMBfAH/AfMBwAE3Af8B8QHg
|
||||
AXkB/wHvAd4BdwH/Ae8BvAEzAf8C/gH8Af8CRwFAAWoCPwE+AWoC/gH8Av8BzAFCAv8B7gGIAf8B/QHK
|
||||
AUAB/wH8AesBhQH/AfsB6gGEAf8B4QF5AVcB/wHzAcABcwH/AfIBvwFyAf8B4QF5AVcB/wHxAeABeAH/
|
||||
Ae8B3gF2Af8B7wG8ATIB/wL+AfwB/wI/AT4BaggAAUMBTAFSAYUBrQHxAv8BqwHvAf4B/wGVAeIB+AH/
|
||||
AWwByQHtAf8BRgGpAdkB/wGYAdwB/gH/AZgB3AH+Af8BmAHcAf4B/wGYAdwB/gH/AaEB5QL/AUMBTAFS
|
||||
AYUIAAI+AT0BaAL/Af4C/wHMAUIB/wH+AcsBQQH/Af0BygFAAf8B/AHJAT8B/wH6AccBPQH/AfgBxQE7
|
||||
Af8B9gHDAToB/wH1AcIBOAH/AfMBwAE2Af8B8QG+ATQB/wHwAb0BMwH/Ae8BvAEyA/8B/gH/Aj4BPQFo
|
||||
AkcBQAFoAv8B/gL/AcwBQwH/Af4BywFCAf8B/QHKAUEB/wH8AckBQAH/AfoBxwE+Af8B+AHFATwB/wH2
|
||||
AcMBOwH/AfUBwgE5Af8B8wHAATcB/wHxAb4BNQH/AfABvQE0Af8B7wG8ATMD/wH+Af8CRwFAAWgCPgE9
|
||||
AWgC/wH+Av8BzAFCAf8B/gHLAUEB/wH9AcoBQAH/AfwByQE/Af8B+gHHAT0B/wHsAYYBYgH/AewBhgFi
|
||||
Af8B7AGGAWIB/wHsAYYBYgH/AfEBvgE0Af8B8AG9ATMB/wHvAbwBMgP/Af4B/wI+AT0BaAgAAUMBTAFQ
|
||||
AYMBiAHcAfQB/wFeAcAB6QH/AV0BvwHqAf8BgAHTAfQB/wGcAeMB/QH/AaIB5gL/AaIB5gL/AaIB5gL/
|
||||
AaIB5gL/AaYB6gL/AUMBTAFQAYMIAAI+AT0BZzj/Aj4BPQFnAkcBQAFnOP8CRwFAAWcCPgE9AWc4/wI+
|
||||
AT0BZwgAATkBOwE9AWEBQgFLAU8BgQFCAUsBTwGBAUIBSwFPAYEBQgFLAU8BgQFCAUsBTwGBAUIBSwFP
|
||||
AYEBQgFLAU8BgQFCAUsBTwGBAUIBSwFPAYEBQgFLAU8BgQE5ATsBPQFhCAADMQFNAj4BPQFmAj4BPQFm
|
||||
Aj4BPQFmAj4BPQFmAj4BPQFmAj4BPQFmAj4BPQFmAj4BPQFmAj4BPQFmAj4BPQFmAj4BPQFmAj4BPQFm
|
||||
Aj4BPQFmAj4BPQFmAzEBTQI3ATQBTQJHAUABZgJHAUABZgJHAUABZgJHAUABZgJHAUABZgJHAUABZgJH
|
||||
AUABZgJHAUABZgJHAUABZgJHAUABZgJHAUABZgJHAUABZgJHAUABZgJHAUABZgI3ATQBTQMxAU0CPgE9
|
||||
AWYCPgE9AWYCPgE9AWYCPgE9AWYCPgE9AWYCPgE9AWYCPgE9AWYCPgE9AWYCPgE9AWYCPgE9AWYCPgE9
|
||||
AWYCPgE9AWYCPgE9AWYCPgE9AWYDMQFNAUIBTQE+BwABPgMAASgDAAFAAwABIAMAAQEBAAEBBgABARYA
|
||||
A/8RAAGAAf8BgAEBBQABfwEAAQEFAAE/AQABAQUAAR8BAAEBBAABgAEPAYABAQQAAcABBwHAAQMEAAHg
|
||||
AQMB4AEDBAAB8AEBAfABAQQAAfgBAAH4BQAB/AEAAfwFAAH+AQgB/gEIBAAB/wEAAf8FAAH/AYAB/wGA
|
||||
BAAB/wHAAf8BwAQAAfgBfwYAAeABPxYAAcABAQYAAcABAQYAAcABAQYAAcABAQYAAcABAQYAAcABAQYA
|
||||
AcABAwYAAcABAwYAAcABAwYAAcABAwYAAcABAwYAAcABAwYACw==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="toolStripMain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>211, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="toolbuttonOpenMib.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAK6SURBVDhPjZNbSNNRHMfPU9DtwR71oZf5IgkF0YMEEYb2
|
||||
EGgG5YNgGQmGSUoYimbel5KKmlM0u3jJSpv3ad7WnGkzb2yO4bByF3WuuTnnnLv47Zw/9YclQQc+/L//
|
||||
P+d8/r/f+Z8/Ib/HjJDcmhaS3P+Bzf2zjr8qiki+QyuE6dNNbIzFw6F8DJ++AVh97c9GK9jcA4LJAlKI
|
||||
rQ7sW9/DpauGZSoFg6JwfJSU+TE0XIXOgqCaAwJ5ASn2bb6F19TM4bO+w4z4HgwWC9YcDugpK3Y7umQy
|
||||
FOZEDMRkZQX7SWS5pMRrboVn9RUHy1/aEqDSajGn0WDZbIZ6bQ0t/f1gIzojI8lPMvaIPPWsN2FP/5yD
|
||||
ZdmLWLwUi/FhZASSqSlOUtXczBMcGZnFVzGUTSr2jI1wfq/lYHms4Tqkc3MYnZ2F0mDAqs3GV8LaiUhN
|
||||
TeYFA5mkenelHg5tNQfLw3UxaOrpQZdUiu7xca5/Mc0do6PQb28jPDk5hRf0PiQi5zcR7JoKDpYHaqIg
|
||||
VyohW1jg+lcZjVwlCzod1p1OXEhMvM8LOtNJvWOpEjZVKQfL/ZVX0NrXh165HP2Tk5hQqzGuUmFQocCm
|
||||
y4XzCQlpvKA9jTTa1WWwzBdzsNxdfhmfFxcxQRct0Q3UmEzY2t2FdWcHdrcb5+LiHvCC1hTSbFOWwDyT
|
||||
x8GyuDQCbRIJ3tBPp6CfU0pbcdA3M4mDCs7ExqYzwWHKibo7pNs6T4+yIofDSqtof3IJBtqzTq+Hx+uF
|
||||
y+OBky5kkh2aT0VFZTNBAEWQFEFqhyvO2pclSe6f03nYnC1EW9FFGOnGGSi+/X14KW6fD3tUtkdzYFiY
|
||||
0O801iWSaNFtUteWGST92nL1R/q1Q7ojAkHV0ZCQkuOhocV/c0wguHvgn2APyuPJ6dI4kpV/gzyjtycp
|
||||
gf8g4Begs1B6Kbj3cQAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="dialogOpenMib.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>337, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -1,94 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{86CC0B65-7985-4017-A252-0A7A18DCAEF3}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>LwipMibViewer</RootNamespace>
|
||||
<AssemblyName>LwipMibViewer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Optimize>false</Optimize>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
|
||||
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="FormMain.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="FormMain.Designer.cs">
|
||||
<DependentUpon>FormMain.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="FormMain.resx">
|
||||
<DependentUpon>FormMain.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="app.config" />
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\SharpSnmpLib\SharpSnmpLib.Mib.csproj">
|
||||
<Project>{CBE20411-5DB7-487D-825D-7694267BB6F5}</Project>
|
||||
<Name>SharpSnmpLib.Mib</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<PropertyGroup />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace LwipMibViewer
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// Der Haupteinstiegspunkt für die Anwendung.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new FormMain());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
// die mit einer Assembly verknüpft sind.
|
||||
[assembly: AssemblyTitle("LwipMibViewer")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("LwipMibViewer")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
|
||||
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
|
||||
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
|
||||
[assembly: Guid("7ffbd1c1-1c64-45bb-b243-2400446c649d")]
|
||||
|
||||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
//
|
||||
// Hauptversion
|
||||
// Nebenversion
|
||||
// Buildnummer
|
||||
// Revision
|
||||
//
|
||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,63 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.225
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LwipMibViewer.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||
/// </summary>
|
||||
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
|
||||
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LwipMibViewer.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -1,26 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// Dieser Code wurde von einem Tool generiert.
|
||||
// Laufzeitversion:4.0.30319.225
|
||||
//
|
||||
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||
// der Code erneut generiert wird.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace LwipMibViewer.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
|
||||
@@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public interface IRestriction
|
||||
{
|
||||
string GetCheckCodeValid(string varNameToCheck);
|
||||
string GetCheckCodeInvalid(string varNameToCheck);
|
||||
}
|
||||
|
||||
public class BitMaskRestriction : IRestriction
|
||||
{
|
||||
UInt32 mask;
|
||||
|
||||
public BitMaskRestriction(UInt32 mask)
|
||||
{
|
||||
this.mask = mask;
|
||||
}
|
||||
|
||||
public string GetCheckCodeValid(string varNameToCheck)
|
||||
{
|
||||
return String.Format("(({0} & {1}) == {0})", varNameToCheck, this.mask);
|
||||
}
|
||||
|
||||
public string GetCheckCodeInvalid(string varNameToCheck)
|
||||
{
|
||||
return String.Format("(({0} & {1}) != {0})", varNameToCheck, this.mask);
|
||||
}
|
||||
}
|
||||
|
||||
public class IsEqualRestriction : IRestriction
|
||||
{
|
||||
private Int64 value;
|
||||
|
||||
public IsEqualRestriction(Int64 value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public long Value
|
||||
{
|
||||
get { return value; }
|
||||
}
|
||||
|
||||
public string GetCheckCodeValid(string varNameToCheck)
|
||||
{
|
||||
return String.Format("({0} == {1})", varNameToCheck, this.value);
|
||||
}
|
||||
|
||||
public string GetCheckCodeInvalid(string varNameToCheck)
|
||||
{
|
||||
return String.Format("({0} != {1})", varNameToCheck, this.value);
|
||||
}
|
||||
}
|
||||
|
||||
public class IsInRangeRestriction : IRestriction
|
||||
{
|
||||
private Int64 rangeStart;
|
||||
private Int64 rangeEnd;
|
||||
|
||||
public IsInRangeRestriction(Int64 rangeStart, Int64 rangeEnd)
|
||||
{
|
||||
this.rangeStart = rangeStart;
|
||||
this.rangeEnd = rangeEnd;
|
||||
}
|
||||
|
||||
public long RangeStart
|
||||
{
|
||||
get { return this.rangeStart; }
|
||||
}
|
||||
|
||||
public long RangeEnd
|
||||
{
|
||||
get { return this.rangeEnd; }
|
||||
}
|
||||
|
||||
public string GetCheckCodeValid(string varNameToCheck)
|
||||
{
|
||||
return String.Format("(({0} >= {1}) && ({0} <= {2}))", varNameToCheck, this.rangeStart, this.rangeEnd);
|
||||
}
|
||||
|
||||
public string GetCheckCodeInvalid(string varNameToCheck)
|
||||
{
|
||||
return String.Format("(({0} < {1}) || ({0} > {2}))", varNameToCheck, this.rangeStart, this.rangeEnd);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,199 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public static class LwipOpts
|
||||
{
|
||||
public static bool GenerateEmptyFolders = false;
|
||||
/// <summary>
|
||||
/// If a tree node only has scalar nodes as child nodes, it is replaced by
|
||||
/// a single scalar array node in order to save memory and have only one single get/test/set method for all scalars.
|
||||
/// </summary>
|
||||
public static bool GenerateScalarArrays = true;
|
||||
/// <summary>
|
||||
/// If a tree node has multiple scalars as subnodes as well as other treenodes it
|
||||
/// defines a single get/test/set method for all scalar child node.
|
||||
/// (without other treenodes as child it would have been converted to scalar array node).
|
||||
/// </summary>
|
||||
public static bool GenerateSingleAccessMethodsForTreeNodeScalars = GenerateScalarArrays;
|
||||
}
|
||||
|
||||
public static class LwipDefs
|
||||
{
|
||||
public const string Null = "NULL";
|
||||
public const string Vt_U8 = "u8_t";
|
||||
public const string Vt_U16 = "u16_t";
|
||||
public const string Vt_U32 = "u32_t";
|
||||
public const string Vt_S8 = "s8_t";
|
||||
public const string Vt_S16 = "s16_t";
|
||||
public const string Vt_S32 = "s32_t";
|
||||
public const string Vt_Snmp_err = "snmp_err_t";
|
||||
|
||||
public const string Incl_SnmpOpts = "lwip/apps/snmp_opts.h";
|
||||
public const string Opt_SnmpEnabled = "LWIP_SNMP";
|
||||
|
||||
public const string Vt_StMib = "struct snmp_mib";
|
||||
public const string Vt_StObjectId = "struct snmp_obj_id";
|
||||
public const string Vt_StNode = "struct snmp_node";
|
||||
public const string Vt_StNodeInstance = "struct snmp_node_instance";
|
||||
public const string Vt_StTreeNode = "struct snmp_tree_node";
|
||||
public const string Vt_StScalarNode = "struct snmp_scalar_node";
|
||||
public const string Vt_StScalarArrayNode = "struct snmp_scalar_array_node";
|
||||
public const string Vt_StScalarArrayNodeDef = "struct snmp_scalar_array_node_def";
|
||||
public const string Vt_StTableNode = "struct snmp_table_node";
|
||||
public const string Vt_StTableColumnDef = "struct snmp_table_col_def";
|
||||
public const string Vt_StNextOidState = "struct snmp_next_oid_state";
|
||||
|
||||
public const string Def_NodeAccessReadOnly = "SNMP_NODE_INSTANCE_READ_ONLY";
|
||||
public const string Def_NodeAccessReadWrite = "SNMP_NODE_INSTANCE_READ_WRITE";
|
||||
public const string Def_NodeAccessWriteOnly = "SNMP_NODE_INSTANCE_WRITE_ONLY";
|
||||
public const string Def_NodeAccessNotAccessible = "SNMP_NODE_INSTANCE_NOT_ACCESSIBLE";
|
||||
|
||||
public const string Def_ErrorCode_Ok = "SNMP_ERR_NOERROR";
|
||||
public const string Def_ErrorCode_WrongValue = "SNMP_ERR_WRONGVALUE";
|
||||
public const string Def_ErrorCode_NoSuchInstance = "SNMP_ERR_NOSUCHINSTANCE";
|
||||
|
||||
public const string FnctSuffix_GetValue = "_get_value";
|
||||
public const string FnctSuffix_SetTest = "_set_test";
|
||||
public const string FnctSuffix_SetValue = "_set_value";
|
||||
public const string FnctSuffix_GetInstance = "_get_instance";
|
||||
public const string FnctSuffix_GetNextInstance = "_get_next_instance";
|
||||
|
||||
public const string FnctName_SetTest_Ok = "snmp_set_test_ok";
|
||||
|
||||
public static string GetLwipDefForSnmpAccessMode(SnmpAccessMode am)
|
||||
{
|
||||
switch (am)
|
||||
{
|
||||
case SnmpAccessMode.ReadOnly: return Def_NodeAccessReadOnly;
|
||||
case SnmpAccessMode.ReadWrite: return Def_NodeAccessReadWrite;
|
||||
case SnmpAccessMode.NotAccessible: return Def_NodeAccessNotAccessible;
|
||||
case SnmpAccessMode.WriteOnly: return Def_NodeAccessWriteOnly;
|
||||
default: throw new NotSupportedException("Unknown SnmpAccessMode!");
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetAsn1DefForSnmpDataType(SnmpDataType dt)
|
||||
{
|
||||
switch (dt)
|
||||
{
|
||||
// primitive
|
||||
case SnmpDataType.Null:
|
||||
return "SNMP_ASN1_TYPE_NULL";
|
||||
case SnmpDataType.Bits:
|
||||
case SnmpDataType.OctetString:
|
||||
return "SNMP_ASN1_TYPE_OCTET_STRING";
|
||||
case SnmpDataType.ObjectIdentifier:
|
||||
return "SNMP_ASN1_TYPE_OBJECT_ID";
|
||||
case SnmpDataType.Integer:
|
||||
return "SNMP_ASN1_TYPE_INTEGER";
|
||||
|
||||
// application
|
||||
case SnmpDataType.IpAddress:
|
||||
return "SNMP_ASN1_TYPE_IPADDR";
|
||||
case SnmpDataType.Counter:
|
||||
return "SNMP_ASN1_TYPE_COUNTER";
|
||||
case SnmpDataType.Gauge:
|
||||
return "SNMP_ASN1_TYPE_GAUGE";
|
||||
case SnmpDataType.TimeTicks:
|
||||
return "SNMP_ASN1_TYPE_TIMETICKS";
|
||||
case SnmpDataType.Opaque:
|
||||
return "SNMP_ASN1_TYPE_OPAQUE";
|
||||
case SnmpDataType.Counter64:
|
||||
return "SNMP_ASN1_TYPE_COUNTER64";
|
||||
default:
|
||||
throw new NotSupportedException("Unknown SnmpDataType!");
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetLengthForSnmpDataType(SnmpDataType dt)
|
||||
{
|
||||
switch (dt)
|
||||
{
|
||||
case SnmpDataType.Null:
|
||||
return "0";
|
||||
|
||||
case SnmpDataType.Integer:
|
||||
case SnmpDataType.Counter:
|
||||
case SnmpDataType.IpAddress:
|
||||
case SnmpDataType.Gauge:
|
||||
case SnmpDataType.TimeTicks:
|
||||
return "4";
|
||||
|
||||
case SnmpDataType.Counter64:
|
||||
return "8";
|
||||
|
||||
case SnmpDataType.OctetString:
|
||||
case SnmpDataType.ObjectIdentifier:
|
||||
case SnmpDataType.Bits:
|
||||
case SnmpDataType.Opaque:
|
||||
return null;
|
||||
|
||||
default:
|
||||
throw new NotSupportedException("Unknown SnmpDataType!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum SnmpDataType
|
||||
{
|
||||
Null,
|
||||
|
||||
Integer, // INTEGER, Integer32
|
||||
|
||||
Counter, // Counter, Counter32
|
||||
Gauge, // Gauge, Gauge32, Unsigned32
|
||||
TimeTicks,
|
||||
|
||||
Counter64,
|
||||
|
||||
OctetString,
|
||||
Opaque,
|
||||
Bits,
|
||||
|
||||
ObjectIdentifier,
|
||||
|
||||
IpAddress,
|
||||
}
|
||||
|
||||
public enum SnmpAccessMode
|
||||
{
|
||||
ReadOnly,
|
||||
ReadWrite,
|
||||
WriteOnly,
|
||||
NotAccessible
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{AABCAB90-1540-45D4-A159-14831A54E9A3}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>LwipSnmpCodeGeneration</RootNamespace>
|
||||
<AssemblyName>LwipSnmpCodeGeneration</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="IRestriction.cs" />
|
||||
<Compile Include="SnmpScalarNodeCounter64.cs" />
|
||||
<Compile Include="SnmpScalarNodeTruthValue.cs" />
|
||||
<Compile Include="SnmpScalarAggregationNode.cs" />
|
||||
<Compile Include="SnmpTableNode.cs" />
|
||||
<Compile Include="SnmpScalarArrayNode.cs" />
|
||||
<Compile Include="MibHeaderFile.cs" />
|
||||
<Compile Include="SnmpScalarNodeBits.cs" />
|
||||
<Compile Include="SnmpMib.cs" />
|
||||
<Compile Include="SnmpScalarNodeInt.cs" />
|
||||
<Compile Include="SnmpScalarNodeObjectIdentifier.cs" />
|
||||
<Compile Include="SnmpScalarNodeOctetString.cs" />
|
||||
<Compile Include="SnmpScalarNodeUint.cs" />
|
||||
<Compile Include="SnmpTreeNode.cs" />
|
||||
<Compile Include="LwipSnmp.cs" />
|
||||
<Compile Include="MibCFile.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SnmpNode.cs" />
|
||||
<Compile Include="SnmpScalarNode.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CCodeGeneration\CCodeGeneration.csproj">
|
||||
<Project>{7DA7C0AB-0982-4BF5-9324-F59A7A08D65B}</Project>
|
||||
<Name>CCodeGeneration</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
@@ -1,196 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using CCodeGeneration;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public class MibCFile
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private const string PreservedSectionMarker = "LWIP MIB generator - preserved section begin";
|
||||
private const string PreservedSectionHeader =
|
||||
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n" +
|
||||
PreservedSectionMarker + "\n" +
|
||||
"Code below is preserved on regeneration. Remove these comment lines to regenerate code.\n" +
|
||||
"+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
|
||||
|
||||
private readonly List<CodeElement> includes = new List<CodeElement>();
|
||||
private readonly List<CodeElement> defines = new List<CodeElement>();
|
||||
private readonly List<CodeElement> declarations = new List<CodeElement>();
|
||||
private readonly List<CodeElement> implementation = new List<CodeElement>();
|
||||
private readonly List<CodeElement> preservedCode = new List<CodeElement>();
|
||||
|
||||
#endregion
|
||||
|
||||
public MibCFile()
|
||||
{
|
||||
}
|
||||
|
||||
#region Accessors
|
||||
|
||||
public List<CodeElement> Includes
|
||||
{
|
||||
get { return this.includes; }
|
||||
}
|
||||
|
||||
public List<CodeElement> Defines
|
||||
{
|
||||
get { return this.defines; }
|
||||
}
|
||||
|
||||
public List<CodeElement> Declarations
|
||||
{
|
||||
get { return this.declarations; }
|
||||
}
|
||||
|
||||
public List<CodeElement> Implementation
|
||||
{
|
||||
get { return this.implementation; }
|
||||
}
|
||||
|
||||
public List<CodeElement> PreservedCode
|
||||
{
|
||||
get { return this.preservedCode; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void Save(CGenerator cGenerator)
|
||||
{
|
||||
CFile cFile = new CFile();
|
||||
|
||||
cFile.AddElement(new Comment("Generated by LwipMibCompiler"));
|
||||
cFile.AddElement(EmptyLine.SingleLine);
|
||||
|
||||
cFile.AddElement(new PP_Include(LwipDefs.Incl_SnmpOpts));
|
||||
CodeContainerBase e = cFile.AddElement(new PP_If(LwipDefs.Opt_SnmpEnabled)) as CodeContainerBase;
|
||||
e.AddElement(EmptyLine.SingleLine);
|
||||
|
||||
// include header file
|
||||
string file = cGenerator.FileName;
|
||||
if (!String.IsNullOrWhiteSpace(file))
|
||||
{
|
||||
string ext = System.IO.Path.GetExtension(file);
|
||||
|
||||
string headerFile = !String.IsNullOrEmpty(ext) ? file.Substring(0, file.Length - ext.Length) : file;
|
||||
headerFile += ".h";
|
||||
|
||||
e.AddElement(new PP_Include(headerFile));
|
||||
}
|
||||
|
||||
// include common snmp files
|
||||
e.AddElement(new PP_Include("lwip/apps/snmp.h"));
|
||||
e.AddElement(new PP_Include("lwip/apps/snmp_core.h"));
|
||||
e.AddElement(new PP_Include("lwip/apps/snmp_scalar.h"));
|
||||
e.AddElement(new PP_Include("lwip/apps/snmp_table.h"));
|
||||
|
||||
if (this.includes.Count > 0)
|
||||
{
|
||||
e.AddElement(EmptyLine.SingleLine);
|
||||
e.AddElements(this.includes);
|
||||
}
|
||||
|
||||
if (this.defines.Count > 0)
|
||||
{
|
||||
e.AddElement(EmptyLine.SingleLine);
|
||||
e.AddElements(this.defines);
|
||||
}
|
||||
|
||||
if (this.declarations.Count > 0)
|
||||
{
|
||||
e.AddElement(EmptyLine.TwoLines);
|
||||
e.AddElements(this.declarations);
|
||||
}
|
||||
|
||||
if (this.implementation.Count > 0)
|
||||
{
|
||||
e.AddElement(EmptyLine.TwoLines);
|
||||
e.AddElements(this.implementation);
|
||||
}
|
||||
|
||||
if (this.preservedCode.Count > 0)
|
||||
{
|
||||
e.AddElement(EmptyLine.TwoLines);
|
||||
e.AddElement(new Comment(PreservedSectionHeader));
|
||||
e.AddElement(EmptyLine.SingleLine);
|
||||
e.AddElements(this.preservedCode);
|
||||
}
|
||||
|
||||
cFile.Save(cGenerator);
|
||||
}
|
||||
|
||||
public static string GetPreservedCode(string file)
|
||||
{
|
||||
if (File.Exists(file))
|
||||
{
|
||||
using (StreamReader fileStream = new StreamReader(file))
|
||||
{
|
||||
while (!fileStream.EndOfStream)
|
||||
{
|
||||
string line = fileStream.ReadLine();
|
||||
if (line == PreservedSectionMarker)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!fileStream.EndOfStream)
|
||||
{
|
||||
// skip the rest of the comment + spacer line
|
||||
fileStream.ReadLine(); // "Code below is preserved...
|
||||
fileStream.ReadLine(); // "+++++++++++++++++++++++...
|
||||
fileStream.ReadLine(); // */
|
||||
fileStream.ReadLine(); //
|
||||
|
||||
string preservedCode = fileStream.ReadToEnd();
|
||||
|
||||
int lastEndif = preservedCode.LastIndexOf("#endif", StringComparison.Ordinal);
|
||||
preservedCode = preservedCode.Remove(lastEndif);
|
||||
|
||||
return preservedCode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using CCodeGeneration;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public class MibHeaderFile
|
||||
{
|
||||
|
||||
#region Fields
|
||||
|
||||
private readonly List<CodeElement> defines = new List<CodeElement>();
|
||||
private readonly List<CodeElement> includes = new List<CodeElement>();
|
||||
private readonly List<CodeElement> functionDeclarations = new List<CodeElement>();
|
||||
private readonly List<CodeElement> variableDeclarations = new List<CodeElement>();
|
||||
|
||||
#endregion
|
||||
|
||||
public MibHeaderFile()
|
||||
{
|
||||
}
|
||||
|
||||
#region Accessors
|
||||
|
||||
public List<CodeElement> Defines
|
||||
{
|
||||
get { return this.defines; }
|
||||
}
|
||||
|
||||
public List<CodeElement> Includes
|
||||
{
|
||||
get { return this.includes; }
|
||||
}
|
||||
|
||||
public List<CodeElement> FunctionDeclarations
|
||||
{
|
||||
get { return this.functionDeclarations; }
|
||||
}
|
||||
|
||||
public List<CodeElement> VariableDeclarations
|
||||
{
|
||||
get { return this.variableDeclarations; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void Save(CGenerator cGenerator)
|
||||
{
|
||||
CFile cFile = new CFile();
|
||||
|
||||
cFile.AddElement(new Comment("Generated by LwipMibCompiler"));
|
||||
cFile.AddElement(EmptyLine.SingleLine);
|
||||
|
||||
string headerDefine = cGenerator.FileName;
|
||||
headerDefine = new Regex("[^a-zA-Z0-9]").Replace(headerDefine, "_");
|
||||
headerDefine = headerDefine.ToUpperInvariant();
|
||||
|
||||
CodeContainerBase e = cFile.AddElement(new PP_Ifdef(headerDefine, inverted: true)) as CodeContainerBase;
|
||||
e.AddElement(new PP_Macro(headerDefine, headerDefine));
|
||||
e.AddElement(EmptyLine.SingleLine);
|
||||
|
||||
e.AddElement(new PP_Include(LwipDefs.Incl_SnmpOpts));
|
||||
e = e.AddElement(new PP_If(LwipDefs.Opt_SnmpEnabled)) as CodeContainerBase;
|
||||
e.AddElement(EmptyLine.SingleLine);
|
||||
|
||||
CodeContainerBase cplusplusopen = e.AddElement(new PP_Ifdef("__cplusplus")) as CodeContainerBase;
|
||||
cplusplusopen.AddElement(new Code("extern \"C\" {"));
|
||||
e.AddElement(EmptyLine.SingleLine);
|
||||
|
||||
if (this.includes.Count > 0)
|
||||
{
|
||||
e.AddElements(this.includes);
|
||||
e.AddElement(EmptyLine.SingleLine);
|
||||
}
|
||||
|
||||
if (this.defines.Count > 0)
|
||||
{
|
||||
e.AddElements(this.defines);
|
||||
e.AddElement(EmptyLine.SingleLine);
|
||||
}
|
||||
|
||||
e.AddElements(this.functionDeclarations, EmptyLine.SingleLine);
|
||||
e.AddElements(this.variableDeclarations, EmptyLine.SingleLine);
|
||||
|
||||
e.AddElement(EmptyLine.SingleLine);
|
||||
CodeContainerBase cplusplusclose = e.AddElement(new PP_Ifdef("__cplusplus")) as CodeContainerBase;
|
||||
cplusplusclose.AddElement(new Code("}"));
|
||||
|
||||
e.AddElement(EmptyLine.SingleLine);
|
||||
cFile.Save(cGenerator);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// Allgemeine Informationen über eine Assembly werden über die folgenden
|
||||
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
|
||||
// die mit einer Assembly verknüpft sind.
|
||||
[assembly: AssemblyTitle("LwipSnmpCodeGeneration")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("LwipSnmpCodeGeneration")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
|
||||
// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
|
||||
// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
|
||||
[assembly: Guid("8cfbbb8b-dfbb-4dd5-80c9-e07845dd58c9")]
|
||||
|
||||
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
|
||||
//
|
||||
// Hauptversion
|
||||
// Nebenversion
|
||||
// Buildnummer
|
||||
// Revision
|
||||
//
|
||||
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
|
||||
// übernehmen, indem Sie "*" eingeben:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -1,97 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using CCodeGeneration;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public class SnmpMib : SnmpTreeNode
|
||||
{
|
||||
public uint[] BaseOid { get; set; }
|
||||
|
||||
public SnmpMib()
|
||||
: base(null)
|
||||
{
|
||||
}
|
||||
|
||||
public SnmpMib(uint[] baseOid)
|
||||
: base(null)
|
||||
{
|
||||
this.BaseOid = baseOid;
|
||||
}
|
||||
|
||||
public override string FullNodeName
|
||||
{
|
||||
get { return this.Name.ToLowerInvariant() + "_root"; }
|
||||
}
|
||||
|
||||
public override void GenerateCode(MibCFile mibFile)
|
||||
{
|
||||
base.GenerateCode(mibFile);
|
||||
|
||||
System.Diagnostics.Debug.Assert((this.BaseOid != null) && (this.BaseOid.Length > 0));
|
||||
|
||||
// create and add BaseOID declarations
|
||||
StringBuilder boidInitialization = new StringBuilder("{");
|
||||
foreach (uint t in this.BaseOid)
|
||||
{
|
||||
boidInitialization.Append(t);
|
||||
boidInitialization.Append(",");
|
||||
}
|
||||
boidInitialization.Length -= 1;
|
||||
boidInitialization.Append("}");
|
||||
|
||||
VariableDeclaration boidDecl = new VariableDeclaration(
|
||||
new VariableType(this.Name.ToLowerInvariant() + "_base_oid", LwipDefs.Vt_U32, null, ConstType.Value, String.Empty),
|
||||
boidInitialization.ToString(), true);
|
||||
|
||||
mibFile.Declarations.Add(boidDecl);
|
||||
mibFile.Declarations.Add(GetExportDeclaration());
|
||||
}
|
||||
|
||||
public override void GenerateHeaderCode(MibHeaderFile mibHeaderFile)
|
||||
{
|
||||
mibHeaderFile.Includes.Add(new PP_Include("lwip/apps/snmp_core.h"));
|
||||
|
||||
mibHeaderFile.VariableDeclarations.Add(VariablePrototype.FromVariableDeclaration(GetExportDeclaration()));
|
||||
}
|
||||
|
||||
VariableDeclaration GetExportDeclaration()
|
||||
{
|
||||
return new VariableDeclaration(
|
||||
new VariableType(this.Name.ToLowerInvariant(), LwipDefs.Vt_StMib, null, ConstType.Value),
|
||||
String.Format("{{{0}_base_oid, LWIP_ARRAYSIZE({0}_base_oid), &{1}.node}}", this.Name.ToLowerInvariant(), this.FullNodeName));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using CCodeGeneration;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public abstract class SnmpNode
|
||||
{
|
||||
public static readonly Regex NameValidationRegex = new Regex(@"^\w+$");
|
||||
|
||||
private string name;
|
||||
private readonly SnmpTreeNode parentNode;
|
||||
|
||||
protected SnmpNode(SnmpTreeNode parentNode)
|
||||
{
|
||||
this.parentNode = parentNode;
|
||||
}
|
||||
|
||||
public SnmpTreeNode ParentNode
|
||||
{
|
||||
get { return this.parentNode; }
|
||||
}
|
||||
|
||||
public virtual uint Oid { get; set; }
|
||||
|
||||
public abstract string FullNodeName
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public virtual string Name
|
||||
{
|
||||
get { return this.name; }
|
||||
set
|
||||
{
|
||||
if (value != this.name)
|
||||
{
|
||||
// check for valid name
|
||||
if (!NameValidationRegex.IsMatch(value))
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("Name");
|
||||
}
|
||||
|
||||
this.name = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Generate(MibCFile generatedFile, MibHeaderFile generatedHeaderFile)
|
||||
{
|
||||
int declCount = generatedFile.Declarations.Count;
|
||||
int implCount = generatedFile.Implementation.Count;
|
||||
|
||||
this.GenerateHeaderCode(generatedHeaderFile);
|
||||
this.GenerateCode(generatedFile);
|
||||
|
||||
if (generatedFile.Declarations.Count != declCount)
|
||||
{
|
||||
generatedFile.Declarations.Add(EmptyLine.SingleLine);
|
||||
}
|
||||
if (generatedFile.Implementation.Count != implCount)
|
||||
{
|
||||
generatedFile.Implementation.Add(EmptyLine.SingleLine);
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void GenerateCode(MibCFile mibFile);
|
||||
|
||||
public virtual void GenerateHeaderCode(MibHeaderFile mibHeaderFile)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called after node structure creation is completed and before code is created.
|
||||
/// Offers the possibility to perform operations depending on properties/subnodes.
|
||||
/// If the node shall be transformed to another node(-type) than the own instance
|
||||
/// may be replaced on parent node by the transformed instance.
|
||||
/// Calling sequence is always from leafs up to root. So a tree node can assume
|
||||
/// that the analyze method was already called on all child nodes.
|
||||
/// E.g. a tree node only has scalar sub nodes -> it transforms itself to a scalar array node
|
||||
/// </summary>
|
||||
/// <returns>The transformed node or null if nothing shall be changed in parent structure.</returns>
|
||||
public virtual void Analyze()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,293 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using CCodeGeneration;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public abstract class SnmpScalarAggregationNode: SnmpNode
|
||||
{
|
||||
private bool getMethodRequired = false;
|
||||
private bool testMethodRequired = false;
|
||||
private bool setMethodRequired = false;
|
||||
|
||||
protected SnmpScalarAggregationNode(SnmpTreeNode parentNode)
|
||||
: base(parentNode)
|
||||
{
|
||||
}
|
||||
|
||||
protected virtual string GetMethodName
|
||||
{
|
||||
get { return this.FullNodeName + LwipDefs.FnctSuffix_GetValue; }
|
||||
}
|
||||
|
||||
protected bool GetMethodRequired
|
||||
{
|
||||
get { return this.getMethodRequired; }
|
||||
}
|
||||
|
||||
protected virtual string TestMethodName
|
||||
{
|
||||
get { return this.FullNodeName + LwipDefs.FnctSuffix_SetTest; }
|
||||
}
|
||||
|
||||
protected bool TestMethodRequired
|
||||
{
|
||||
get { return this.testMethodRequired; }
|
||||
}
|
||||
|
||||
protected virtual string SetMethodName
|
||||
{
|
||||
get { return this.FullNodeName + LwipDefs.FnctSuffix_SetValue; }
|
||||
}
|
||||
|
||||
protected bool SetMethodRequired
|
||||
{
|
||||
get { return this.setMethodRequired; }
|
||||
}
|
||||
|
||||
protected abstract IEnumerable<SnmpScalarNode> AggregatedScalarNodes
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
public override void Analyze()
|
||||
{
|
||||
base.Analyze();
|
||||
|
||||
this.getMethodRequired = false;
|
||||
this.testMethodRequired = false;
|
||||
this.setMethodRequired = false;
|
||||
|
||||
foreach (SnmpScalarNode scalarNode in this.AggregatedScalarNodes)
|
||||
{
|
||||
if ((scalarNode.AccessMode == SnmpAccessMode.ReadOnly) || (scalarNode.AccessMode == SnmpAccessMode.ReadWrite))
|
||||
{
|
||||
this.getMethodRequired = true;
|
||||
}
|
||||
if ((scalarNode.AccessMode == SnmpAccessMode.WriteOnly) || (scalarNode.AccessMode == SnmpAccessMode.ReadWrite))
|
||||
{
|
||||
this.testMethodRequired = true;
|
||||
this.setMethodRequired = true;
|
||||
}
|
||||
|
||||
if (this.getMethodRequired && this.setMethodRequired)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void GenerateAggregatedCode(MibCFile mibFile, VariableType instanceType, string switchSelector, bool generateDeclarations = true, bool generateImplementations = true)
|
||||
{
|
||||
if (this.getMethodRequired)
|
||||
{
|
||||
FunctionDeclaration getMethodDecl = new FunctionDeclaration(this.GetMethodName, isStatic: true);
|
||||
getMethodDecl.Parameter.Add(instanceType);
|
||||
getMethodDecl.Parameter.Add(new VariableType("value", VariableType.VoidString, "*"));
|
||||
getMethodDecl.ReturnType = new VariableType(null, LwipDefs.Vt_U16);
|
||||
|
||||
if (generateDeclarations)
|
||||
{
|
||||
mibFile.Declarations.Add(getMethodDecl);
|
||||
}
|
||||
if (generateImplementations)
|
||||
{
|
||||
Function getMethod = Function.FromDeclaration(getMethodDecl);
|
||||
GenerateGetMethodCode(getMethod, switchSelector);
|
||||
mibFile.Implementation.Add(getMethod);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.testMethodRequired)
|
||||
{
|
||||
FunctionDeclaration testMethodDecl = new FunctionDeclaration(this.TestMethodName, isStatic: true);
|
||||
testMethodDecl.Parameter.Add(instanceType);
|
||||
testMethodDecl.Parameter.Add(new VariableType("len", LwipDefs.Vt_U16));
|
||||
testMethodDecl.Parameter.Add(new VariableType("value", VariableType.VoidString, "*"));
|
||||
testMethodDecl.ReturnType = new VariableType(null, LwipDefs.Vt_Snmp_err);
|
||||
|
||||
if (generateDeclarations)
|
||||
{
|
||||
mibFile.Declarations.Add(testMethodDecl);
|
||||
}
|
||||
if (generateImplementations)
|
||||
{
|
||||
Function testMethod = Function.FromDeclaration(testMethodDecl);
|
||||
GenerateTestMethodCode(testMethod, switchSelector);
|
||||
mibFile.Implementation.Add(testMethod);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.setMethodRequired)
|
||||
{
|
||||
FunctionDeclaration setMethodDecl = new FunctionDeclaration(this.SetMethodName, isStatic: true);
|
||||
setMethodDecl.Parameter.Add(instanceType);
|
||||
setMethodDecl.Parameter.Add(new VariableType("len", LwipDefs.Vt_U16));
|
||||
setMethodDecl.Parameter.Add(new VariableType("value", VariableType.VoidString, "*"));
|
||||
setMethodDecl.ReturnType = new VariableType(null, LwipDefs.Vt_Snmp_err);
|
||||
|
||||
if (generateDeclarations)
|
||||
{
|
||||
mibFile.Declarations.Add(setMethodDecl);
|
||||
}
|
||||
if (generateImplementations)
|
||||
{
|
||||
Function setMethod = Function.FromDeclaration(setMethodDecl);
|
||||
GenerateSetMethodCode(setMethod, switchSelector);
|
||||
mibFile.Implementation.Add(setMethod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void GenerateGetMethodCode(Function getMethod, string switchSelector)
|
||||
{
|
||||
VariableDeclaration returnValue = new VariableDeclaration((VariableType)getMethod.ReturnType.Clone());
|
||||
returnValue.Type.Name = "value_len";
|
||||
getMethod.Declarations.Add(returnValue);
|
||||
Switch sw = new Switch(switchSelector);
|
||||
|
||||
bool valueVarUsed = false;
|
||||
|
||||
foreach (SnmpScalarNode scalarNode in this.AggregatedScalarNodes)
|
||||
{
|
||||
if ((scalarNode.AccessMode == SnmpAccessMode.ReadOnly) || (scalarNode.AccessMode == SnmpAccessMode.ReadWrite))
|
||||
{
|
||||
SwitchCase sc = new SwitchCase(scalarNode.Oid.ToString(CultureInfo.InvariantCulture));
|
||||
sc.Declarations.Add(new Comment(scalarNode.Name, singleLine: true));
|
||||
|
||||
scalarNode.GenerateGetMethodCode(sc, getMethod.Parameter[1].Name, ref valueVarUsed, returnValue.Type.Name);
|
||||
|
||||
sw.Switches.Add(sc);
|
||||
}
|
||||
}
|
||||
|
||||
SwitchCase scd = SwitchCase.GenerateDefault();
|
||||
scd.AddCodeFormat("LWIP_DEBUGF(SNMP_MIB_DEBUG,(\"{0}(): unknown id: %\"S32_F\"\\n\", {1}));", getMethod.Name, switchSelector);
|
||||
scd.AddCodeFormat("{0} = 0;", returnValue.Type.Name);
|
||||
sw.Switches.Add(scd);
|
||||
|
||||
if (!valueVarUsed)
|
||||
{
|
||||
getMethod.AddCodeFormat("LWIP_UNUSED_ARG({0});", getMethod.Parameter[1].Name);
|
||||
}
|
||||
|
||||
getMethod.AddElement(sw);
|
||||
|
||||
getMethod.AddCodeFormat("return {0};", returnValue.Type.Name);
|
||||
}
|
||||
|
||||
protected virtual void GenerateTestMethodCode(Function testMethod, string switchSelector)
|
||||
{
|
||||
VariableDeclaration returnValue = new VariableDeclaration((VariableType)testMethod.ReturnType.Clone(), LwipDefs.Def_ErrorCode_WrongValue);
|
||||
returnValue.Type.Name = "err";
|
||||
testMethod.Declarations.Add(returnValue);
|
||||
Switch sw = new Switch(switchSelector);
|
||||
|
||||
bool valueVarUsed = false;
|
||||
bool lenVarUsed = false;
|
||||
|
||||
foreach (SnmpScalarNode scalarNode in this.AggregatedScalarNodes)
|
||||
{
|
||||
if ((scalarNode.AccessMode == SnmpAccessMode.WriteOnly) || (scalarNode.AccessMode == SnmpAccessMode.ReadWrite))
|
||||
{
|
||||
SwitchCase sc = new SwitchCase(scalarNode.Oid.ToString(CultureInfo.InvariantCulture));
|
||||
sc.Declarations.Add(new Comment(scalarNode.Name, singleLine: true));
|
||||
|
||||
scalarNode.GenerateTestMethodCode(sc, testMethod.Parameter[2].Name, ref valueVarUsed, testMethod.Parameter[1].Name, ref lenVarUsed, returnValue.Type.Name);
|
||||
|
||||
sw.Switches.Add(sc);
|
||||
}
|
||||
}
|
||||
|
||||
SwitchCase scd = SwitchCase.GenerateDefault();
|
||||
scd.AddCodeFormat("LWIP_DEBUGF(SNMP_MIB_DEBUG,(\"{0}(): unknown id: %\"S32_F\"\\n\", {1}));", testMethod.Name, switchSelector);
|
||||
sw.Switches.Add(scd);
|
||||
|
||||
if (!valueVarUsed)
|
||||
{
|
||||
testMethod.AddCodeFormat("LWIP_UNUSED_ARG({0});", testMethod.Parameter[2].Name);
|
||||
}
|
||||
if (!lenVarUsed)
|
||||
{
|
||||
testMethod.AddCodeFormat("LWIP_UNUSED_ARG({0});", testMethod.Parameter[1].Name);
|
||||
}
|
||||
|
||||
testMethod.AddElement(sw);
|
||||
|
||||
testMethod.AddCodeFormat("return {0};", returnValue.Type.Name);
|
||||
}
|
||||
|
||||
protected virtual void GenerateSetMethodCode(Function setMethod, string switchSelector)
|
||||
{
|
||||
VariableDeclaration returnValue = new VariableDeclaration((VariableType)setMethod.ReturnType.Clone(), LwipDefs.Def_ErrorCode_Ok);
|
||||
returnValue.Type.Name = "err";
|
||||
setMethod.Declarations.Add(returnValue);
|
||||
Switch sw = new Switch(switchSelector);
|
||||
|
||||
bool valueVarUsed = false;
|
||||
bool lenVarUsed = false;
|
||||
|
||||
foreach (SnmpScalarNode scalarNode in this.AggregatedScalarNodes)
|
||||
{
|
||||
if ((scalarNode.AccessMode == SnmpAccessMode.WriteOnly) || (scalarNode.AccessMode == SnmpAccessMode.ReadWrite))
|
||||
{
|
||||
SwitchCase sc = new SwitchCase(scalarNode.Oid.ToString(CultureInfo.InvariantCulture));
|
||||
sc.Declarations.Add(new Comment(scalarNode.Name, singleLine: true));
|
||||
|
||||
scalarNode.GenerateSetMethodCode(sc, setMethod.Parameter[2].Name, ref valueVarUsed, setMethod.Parameter[1].Name, ref lenVarUsed, returnValue.Type.Name);
|
||||
|
||||
sw.Switches.Add(sc);
|
||||
}
|
||||
}
|
||||
|
||||
SwitchCase scd = SwitchCase.GenerateDefault();
|
||||
scd.AddCodeFormat("LWIP_DEBUGF(SNMP_MIB_DEBUG,(\"{0}(): unknown id: %\"S32_F\"\\n\", {1}));", setMethod.Name, switchSelector);
|
||||
sw.Switches.Add(scd);
|
||||
|
||||
if (!valueVarUsed)
|
||||
{
|
||||
setMethod.AddCodeFormat("LWIP_UNUSED_ARG({0});", setMethod.Parameter[2].Name);
|
||||
}
|
||||
if (!lenVarUsed)
|
||||
{
|
||||
setMethod.AddCodeFormat("LWIP_UNUSED_ARG({0});", setMethod.Parameter[1].Name);
|
||||
}
|
||||
|
||||
setMethod.AddElement(sw);
|
||||
|
||||
setMethod.AddCodeFormat("return {0};", returnValue.Type.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,105 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using CCodeGeneration;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public class SnmpScalarArrayNode : SnmpScalarAggregationNode
|
||||
{
|
||||
private readonly List<SnmpScalarNode> scalarNodes;
|
||||
|
||||
public SnmpScalarArrayNode(List<SnmpScalarNode> scalarNodes, SnmpTreeNode parentNode)
|
||||
: base(parentNode)
|
||||
{
|
||||
this.scalarNodes = scalarNodes;
|
||||
}
|
||||
|
||||
public override string FullNodeName
|
||||
{
|
||||
get { return this.Name.ToLowerInvariant() + "_scalars"; }
|
||||
}
|
||||
|
||||
protected override IEnumerable<SnmpScalarNode> AggregatedScalarNodes
|
||||
{
|
||||
get { return this.scalarNodes; }
|
||||
}
|
||||
|
||||
public override void GenerateCode(MibCFile mibFile)
|
||||
{
|
||||
VariableType instanceType = new VariableType("node", LwipDefs.Vt_StScalarArrayNodeDef, "*", ConstType.Value);
|
||||
GenerateAggregatedCode(
|
||||
mibFile,
|
||||
instanceType,
|
||||
instanceType.Name + "->oid");
|
||||
|
||||
|
||||
// create and add node definitions
|
||||
StringBuilder nodeDefs = new StringBuilder();
|
||||
foreach (SnmpScalarNode scalarNode in this.scalarNodes)
|
||||
{
|
||||
nodeDefs.AppendFormat(" {{{0}, {1}, {2}}}, /* {3} */ \n",
|
||||
scalarNode.Oid,
|
||||
LwipDefs.GetAsn1DefForSnmpDataType(scalarNode.DataType),
|
||||
LwipDefs.GetLwipDefForSnmpAccessMode(scalarNode.AccessMode),
|
||||
scalarNode.Name);
|
||||
}
|
||||
if (nodeDefs.Length > 0)
|
||||
nodeDefs.Length--;
|
||||
|
||||
VariableDeclaration nodeDefsDecl = new VariableDeclaration(
|
||||
new VariableType(this.FullNodeName + "_nodes", LwipDefs.Vt_StScalarArrayNodeDef, null, ConstType.Value, String.Empty),
|
||||
"{\n" + nodeDefs + "\n}" ,
|
||||
isStatic: true);
|
||||
|
||||
mibFile.Declarations.Add(nodeDefsDecl);
|
||||
|
||||
|
||||
// create and add node declaration
|
||||
string nodeInitialization = String.Format("SNMP_SCALAR_CREATE_ARRAY_NODE({0}, {1}, {2}, {3}, {4})",
|
||||
this.Oid,
|
||||
nodeDefsDecl.Type.Name,
|
||||
(this.GetMethodRequired) ? this.GetMethodName : LwipDefs.Null,
|
||||
(this.TestMethodRequired) ? this.TestMethodName : LwipDefs.Null,
|
||||
(this.SetMethodRequired) ? this.SetMethodName : LwipDefs.Null
|
||||
);
|
||||
|
||||
mibFile.Declarations.Add(new VariableDeclaration(
|
||||
new VariableType(this.FullNodeName, LwipDefs.Vt_StScalarArrayNode, null, ConstType.Value),
|
||||
nodeInitialization,
|
||||
isStatic: true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,395 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CCodeGeneration;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public class SnmpScalarNode: SnmpNode
|
||||
{
|
||||
protected const string LocalValueName = "v"; // name of (casted) local value variable
|
||||
|
||||
private SnmpDataType dataType;
|
||||
private SnmpAccessMode accessMode;
|
||||
private readonly List<IRestriction> restrictions = new List<IRestriction>();
|
||||
|
||||
private bool useExternalMethods = false;
|
||||
private string externalGetMethod;
|
||||
private string externalTestMethod;
|
||||
private string externalSetMethod;
|
||||
|
||||
|
||||
public SnmpScalarNode(SnmpTreeNode parentNode)
|
||||
: base(parentNode)
|
||||
{
|
||||
}
|
||||
|
||||
public override string FullNodeName
|
||||
{
|
||||
get { return this.Name.ToLowerInvariant() + "_scalar"; }
|
||||
}
|
||||
|
||||
public SnmpDataType DataType
|
||||
{
|
||||
get { return this.dataType; }
|
||||
set { this.dataType = value; }
|
||||
}
|
||||
|
||||
public List<IRestriction> Restrictions
|
||||
{
|
||||
get { return this.restrictions; }
|
||||
}
|
||||
|
||||
public SnmpAccessMode AccessMode
|
||||
{
|
||||
get { return this.accessMode; }
|
||||
set { this.accessMode = value; }
|
||||
}
|
||||
|
||||
public virtual string FixedValueLength
|
||||
{
|
||||
get { return null; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If scalar is used as a table index its value becomes part of the OID. This value returns how many OID parts are required to represent this value.
|
||||
/// </summary>
|
||||
public virtual int OidRepresentationLen
|
||||
{
|
||||
get { return -1; }
|
||||
}
|
||||
|
||||
public bool UseExternalMethods
|
||||
{
|
||||
get { return this.useExternalMethods; }
|
||||
set { this.useExternalMethods = value; }
|
||||
}
|
||||
|
||||
public string ExternalGetMethod
|
||||
{
|
||||
get { return this.externalGetMethod; }
|
||||
set { this.externalGetMethod = value; }
|
||||
}
|
||||
public string ExternalTestMethod
|
||||
{
|
||||
get { return this.externalTestMethod; }
|
||||
set { this.externalTestMethod = value; }
|
||||
}
|
||||
public string ExternalSetMethod
|
||||
{
|
||||
get { return this.externalSetMethod; }
|
||||
set { this.externalSetMethod = value; }
|
||||
}
|
||||
|
||||
public override void GenerateCode(MibCFile mibFile)
|
||||
{
|
||||
string getMethodName;
|
||||
string testMethodName;
|
||||
string setMethodName;
|
||||
|
||||
if (this.useExternalMethods)
|
||||
{
|
||||
getMethodName = this.externalGetMethod;
|
||||
testMethodName = this.externalTestMethod;
|
||||
setMethodName = this.externalSetMethod;
|
||||
}
|
||||
else
|
||||
{
|
||||
getMethodName = LwipDefs.Null;
|
||||
testMethodName = LwipDefs.Null;
|
||||
setMethodName = LwipDefs.Null;
|
||||
|
||||
if ((this.accessMode == SnmpAccessMode.ReadWrite) || (this.accessMode == SnmpAccessMode.ReadOnly))
|
||||
{
|
||||
FunctionDeclaration getMethodDecl = new FunctionDeclaration(this.Name + LwipDefs.FnctSuffix_GetValue, isStatic: true);
|
||||
getMethodDecl.Parameter.Add(new VariableType("instance", LwipDefs.Vt_StNodeInstance, "*"));
|
||||
getMethodDecl.Parameter.Add(new VariableType("value", VariableType.VoidString, "*"));
|
||||
getMethodDecl.ReturnType = new VariableType(null, LwipDefs.Vt_U16);
|
||||
mibFile.Declarations.Add(getMethodDecl);
|
||||
|
||||
Function getMethod = Function.FromDeclaration(getMethodDecl);
|
||||
getMethodName = getMethod.Name;
|
||||
|
||||
VariableDeclaration returnValue = new VariableDeclaration((VariableType)getMethod.ReturnType.Clone());
|
||||
returnValue.Type.Name = "value_len";
|
||||
getMethod.Declarations.Add(returnValue);
|
||||
getMethod.AddCodeFormat("LWIP_UNUSED_ARG({0});", getMethod.Parameter[0].Name);
|
||||
|
||||
bool valueVarUsed = false;
|
||||
GenerateGetMethodCode(getMethod, getMethod.Parameter[1].Name, ref valueVarUsed, returnValue.Type.Name);
|
||||
if (!valueVarUsed)
|
||||
{
|
||||
getMethod.AddCodeFormat("LWIP_UNUSED_ARG({0});", getMethod.Parameter[1].Name);
|
||||
}
|
||||
|
||||
getMethod.AddCodeFormat("return {0};", returnValue.Type.Name);
|
||||
|
||||
mibFile.Implementation.Add(getMethod);
|
||||
}
|
||||
|
||||
if ((this.accessMode == SnmpAccessMode.ReadWrite) || (this.accessMode == SnmpAccessMode.WriteOnly))
|
||||
{
|
||||
bool valueVarUsed;
|
||||
bool lenVarUsed;
|
||||
VariableDeclaration returnValue;
|
||||
|
||||
if (this.restrictions.Count > 0)
|
||||
{
|
||||
FunctionDeclaration testMethodDecl = new FunctionDeclaration(this.Name + LwipDefs.FnctSuffix_SetTest, isStatic: true);
|
||||
testMethodDecl.Parameter.Add(new VariableType("instance", LwipDefs.Vt_StNodeInstance, "*"));
|
||||
testMethodDecl.Parameter.Add(new VariableType("len", LwipDefs.Vt_U16));
|
||||
testMethodDecl.Parameter.Add(new VariableType("value", VariableType.VoidString, "*"));
|
||||
testMethodDecl.ReturnType = new VariableType(null, LwipDefs.Vt_Snmp_err);
|
||||
mibFile.Declarations.Add(testMethodDecl);
|
||||
|
||||
Function testMethod = Function.FromDeclaration(testMethodDecl);
|
||||
testMethodName = testMethod.Name;
|
||||
|
||||
returnValue = new VariableDeclaration((VariableType)testMethod.ReturnType.Clone(), LwipDefs.Def_ErrorCode_WrongValue);
|
||||
returnValue.Type.Name = "err";
|
||||
testMethod.Declarations.Add(returnValue);
|
||||
testMethod.AddCodeFormat("LWIP_UNUSED_ARG({0});", testMethod.Parameter[0].Name);
|
||||
|
||||
valueVarUsed = false;
|
||||
lenVarUsed = false;
|
||||
|
||||
GenerateTestMethodCode(testMethod, testMethod.Parameter[2].Name, ref valueVarUsed, testMethod.Parameter[1].Name, ref lenVarUsed, returnValue.Type.Name);
|
||||
|
||||
if (!valueVarUsed)
|
||||
{
|
||||
testMethod.AddCodeFormat("LWIP_UNUSED_ARG({0});", testMethod.Parameter[2].Name);
|
||||
}
|
||||
if (!lenVarUsed)
|
||||
{
|
||||
testMethod.AddCodeFormat("LWIP_UNUSED_ARG({0});", testMethod.Parameter[1].Name);
|
||||
}
|
||||
|
||||
testMethod.AddCodeFormat("return {0};", returnValue.Type.Name);
|
||||
|
||||
mibFile.Implementation.Add(testMethod);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
testMethodName = LwipDefs.FnctName_SetTest_Ok;
|
||||
}
|
||||
|
||||
FunctionDeclaration setMethodDecl = null;
|
||||
setMethodDecl = new FunctionDeclaration(this.Name + LwipDefs.FnctSuffix_SetValue, isStatic: true);
|
||||
setMethodDecl.Parameter.Add(new VariableType("instance", LwipDefs.Vt_StNodeInstance, "*"));
|
||||
setMethodDecl.Parameter.Add(new VariableType("len", LwipDefs.Vt_U16));
|
||||
setMethodDecl.Parameter.Add(new VariableType("value", VariableType.VoidString, "*"));
|
||||
setMethodDecl.ReturnType = new VariableType(null, LwipDefs.Vt_Snmp_err);
|
||||
mibFile.Declarations.Add(setMethodDecl);
|
||||
|
||||
Function setMethod = Function.FromDeclaration(setMethodDecl);
|
||||
setMethodName = setMethod.Name;
|
||||
|
||||
returnValue = new VariableDeclaration((VariableType)setMethod.ReturnType.Clone(), LwipDefs.Def_ErrorCode_Ok);
|
||||
returnValue.Type.Name = "err";
|
||||
setMethod.Declarations.Add(returnValue);
|
||||
setMethod.AddCodeFormat("LWIP_UNUSED_ARG({0});", setMethod.Parameter[0].Name);
|
||||
|
||||
valueVarUsed = false;
|
||||
lenVarUsed = false;
|
||||
|
||||
GenerateSetMethodCode(setMethod, setMethod.Parameter[2].Name, ref valueVarUsed, setMethod.Parameter[1].Name, ref lenVarUsed, returnValue.Type.Name);
|
||||
|
||||
if (!valueVarUsed)
|
||||
{
|
||||
setMethod.AddCodeFormat("LWIP_UNUSED_ARG({0});", setMethod.Parameter[2].Name);
|
||||
}
|
||||
if (!lenVarUsed)
|
||||
{
|
||||
setMethod.AddCodeFormat("LWIP_UNUSED_ARG({0});", setMethod.Parameter[1].Name);
|
||||
}
|
||||
|
||||
setMethod.AddCodeFormat("return {0};", returnValue.Type.Name);
|
||||
|
||||
mibFile.Implementation.Add(setMethod);
|
||||
}
|
||||
}
|
||||
|
||||
// create and add node declaration
|
||||
string nodeInitialization;
|
||||
if (this.accessMode == SnmpAccessMode.ReadOnly)
|
||||
{
|
||||
nodeInitialization = String.Format("SNMP_SCALAR_CREATE_NODE_READONLY({0}, {1}, {2})",
|
||||
this.Oid,
|
||||
LwipDefs.GetAsn1DefForSnmpDataType(this.dataType),
|
||||
getMethodName);
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeInitialization = String.Format("SNMP_SCALAR_CREATE_NODE({0}, {1}, {2}, {3}, {4}, {5})",
|
||||
this.Oid,
|
||||
LwipDefs.GetLwipDefForSnmpAccessMode(this.accessMode),
|
||||
LwipDefs.GetAsn1DefForSnmpDataType(this.dataType),
|
||||
getMethodName,
|
||||
testMethodName,
|
||||
setMethodName);
|
||||
}
|
||||
|
||||
mibFile.Declarations.Add(new VariableDeclaration(
|
||||
new VariableType(this.FullNodeName, LwipDefs.Vt_StScalarNode, null, ConstType.Value),
|
||||
nodeInitialization, isStatic: true));
|
||||
}
|
||||
|
||||
public virtual void GenerateGetMethodCode(CodeContainerBase container, string valueVarName, ref bool valueVarUsed, string retLenVarName)
|
||||
{
|
||||
bool localValueVarUsed;
|
||||
if (GenerateValueDeclaration(container, LocalValueName, valueVarName))
|
||||
{
|
||||
valueVarUsed = true;
|
||||
localValueVarUsed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
localValueVarUsed = true; // do not generate UNUSED_ARG code
|
||||
}
|
||||
|
||||
if (this.FixedValueLength == null)
|
||||
{
|
||||
// check that value with variable length fits into buffer
|
||||
container.AddElement(new Comment(String.Format("TODO: take care that value with variable length fits into buffer: ({0} <= SNMP_MAX_VALUE_SIZE)", retLenVarName), singleLine: true));
|
||||
}
|
||||
|
||||
GenerateGetMethodCodeCore(container, LocalValueName, ref localValueVarUsed, retLenVarName);
|
||||
if (!localValueVarUsed)
|
||||
{
|
||||
container.AddCode(String.Format("LWIP_UNUSED_ARG({0});", LocalValueName));
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void GenerateGetMethodCodeCore(CodeContainerBase container, string localValueVarName, ref bool localValueVarUsed, string retLenVarName)
|
||||
{
|
||||
container.AddElement(new Comment(String.Format("TODO: put requested value to '*{0}' here", localValueVarName), singleLine: true));
|
||||
container.AddCodeFormat("{0} = {1};",
|
||||
retLenVarName,
|
||||
(!String.IsNullOrWhiteSpace(this.FixedValueLength)) ? this.FixedValueLength : "0");
|
||||
}
|
||||
|
||||
public virtual void GenerateTestMethodCode(CodeContainerBase container, string valueVarName, ref bool valueVarUsed, string lenVarName, ref bool lenVarUsed, string retErrVarName)
|
||||
{
|
||||
if (this.Restrictions.Count > 0)
|
||||
{
|
||||
bool localVarUsed;
|
||||
if (GenerateValueDeclaration(container, LocalValueName, valueVarName))
|
||||
{
|
||||
valueVarUsed = true;
|
||||
localVarUsed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
localVarUsed = true; // do not generate UNUSED_ARG code
|
||||
}
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(this.FixedValueLength))
|
||||
{
|
||||
// check for fixed value
|
||||
container.AddCodeFormat("LWIP_ASSERT(\"Invalid length for datatype\", ({0} == {1}));", lenVarName, this.FixedValueLength);
|
||||
lenVarUsed = true;
|
||||
}
|
||||
|
||||
GenerateTestMethodCodeCore(container, LocalValueName, ref localVarUsed, lenVarName, ref lenVarUsed, retErrVarName);
|
||||
|
||||
if (!localVarUsed)
|
||||
{
|
||||
container.AddCode(String.Format("LWIP_UNUSED_ARG({0});", LocalValueName));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
container.AddCodeFormat("{0} == {1};", retErrVarName, LwipDefs.Def_ErrorCode_Ok);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void GenerateTestMethodCodeCore(CodeContainerBase container, string localValueVarName, ref bool localValueVarUsed, string lenVarName, ref bool lenVarUsed, string retErrVarName)
|
||||
{
|
||||
container.AddElement(new Comment(String.Format("TODO: test new value here:\nif (*{0} == ) {1} = {2};", localValueVarName, retErrVarName, LwipDefs.Def_ErrorCode_Ok)));
|
||||
}
|
||||
|
||||
public virtual void GenerateSetMethodCode(CodeContainerBase container, string valueVarName, ref bool valueVarUsed, string lenVarName, ref bool lenVarUsed, string retErrVarName)
|
||||
{
|
||||
bool localVarUsed;
|
||||
if (GenerateValueDeclaration(container, LocalValueName, valueVarName))
|
||||
{
|
||||
valueVarUsed = true;
|
||||
localVarUsed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
localVarUsed = true; // do not generate UNUSED_ARG code
|
||||
}
|
||||
|
||||
GenerateSetMethodCodeCore(container, LocalValueName, ref localVarUsed, lenVarName, ref lenVarUsed, retErrVarName);
|
||||
|
||||
if (!localVarUsed)
|
||||
{
|
||||
container.AddCode(String.Format("LWIP_UNUSED_ARG({0});", LocalValueName));
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void GenerateSetMethodCodeCore(CodeContainerBase container, string localValueVarName, ref bool localValueVarUsed, string lenVarName, ref bool lenVarUsed, string retErrVarName)
|
||||
{
|
||||
container.AddElement(new Comment(String.Format("TODO: store new value contained in '*{0}' here", localValueVarName), singleLine: true));
|
||||
}
|
||||
|
||||
|
||||
protected virtual bool GenerateValueDeclaration(CodeContainerBase container, string variableName, string sourceName)
|
||||
{
|
||||
container.AddDeclaration(new VariableDeclaration(
|
||||
new VariableType(variableName, LwipDefs.Vt_U8, "*"),
|
||||
"(" + new VariableType(null, LwipDefs.Vt_U8, "*") + ")" + sourceName));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static SnmpScalarNode CreateFromDatatype(SnmpDataType dataType, SnmpTreeNode parentNode)
|
||||
{
|
||||
switch (dataType)
|
||||
{
|
||||
case SnmpDataType.Integer:
|
||||
return new SnmpScalarNodeInt(parentNode);
|
||||
|
||||
case SnmpDataType.Gauge:
|
||||
case SnmpDataType.Counter:
|
||||
case SnmpDataType.TimeTicks:
|
||||
return new SnmpScalarNodeUint(dataType, parentNode);
|
||||
}
|
||||
|
||||
return new SnmpScalarNode(parentNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using CCodeGeneration;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public class SnmpScalarNodeBits : SnmpScalarNode
|
||||
{
|
||||
private readonly uint bitCount;
|
||||
|
||||
public SnmpScalarNodeBits(SnmpTreeNode parentNode, uint bitCount)
|
||||
: base(parentNode)
|
||||
{
|
||||
this.DataType = SnmpDataType.Bits;
|
||||
this.bitCount = bitCount;
|
||||
}
|
||||
|
||||
public override void GenerateGetMethodCode(CodeContainerBase container, string valueVarName, ref bool valueVarUsed, string retLenVarName)
|
||||
{
|
||||
container.AddCode(String.Format(
|
||||
"{0} = snmp_encode_bits(({1} *){2}, SNMP_MAX_VALUE_SIZE, 0 /* TODO: pass real value here */, {3});",
|
||||
retLenVarName,
|
||||
LwipDefs.Vt_U8,
|
||||
valueVarName,
|
||||
this.bitCount));
|
||||
|
||||
valueVarUsed = true;
|
||||
}
|
||||
|
||||
public override void GenerateTestMethodCode(CodeContainerBase container, string valueVarName, ref bool valueVarUsed, string lenVarName, ref bool lenVarUsed, string retErrVarName)
|
||||
{
|
||||
if (this.Restrictions.Count > 0)
|
||||
{
|
||||
const string bitVarName = "bits";
|
||||
|
||||
container.Declarations.Add(new VariableDeclaration(new VariableType(bitVarName, LwipDefs.Vt_U32)));
|
||||
|
||||
IfThenElse ite = new IfThenElse(String.Format(
|
||||
"snmp_decode_bits(({0} *){1}, {2}, &{3}) == ERR_OK",
|
||||
LwipDefs.Vt_U8,
|
||||
valueVarName,
|
||||
lenVarName,
|
||||
bitVarName));
|
||||
|
||||
valueVarUsed = true;
|
||||
lenVarUsed = true;
|
||||
|
||||
StringBuilder innerIfCond = new StringBuilder();
|
||||
foreach (IRestriction restriction in this.Restrictions)
|
||||
{
|
||||
innerIfCond.Append(restriction.GetCheckCodeValid(bitVarName));
|
||||
innerIfCond.Append(" || ");
|
||||
}
|
||||
|
||||
innerIfCond.Length -= 4;
|
||||
|
||||
IfThenElse innerIte = new IfThenElse(innerIfCond.ToString());
|
||||
innerIte.AddCode(String.Format("{0} = {1};", retErrVarName, LwipDefs.Def_ErrorCode_Ok));
|
||||
ite.AddElement(innerIte);
|
||||
container.AddElement(ite);
|
||||
}
|
||||
else
|
||||
{
|
||||
base.GenerateTestMethodCode(container, valueVarName, ref valueVarUsed, lenVarName, ref lenVarUsed, retErrVarName);
|
||||
}
|
||||
}
|
||||
|
||||
public override void GenerateSetMethodCode(CodeContainerBase container, string valueVarName, ref bool valueVarUsed, string lenVarName, ref bool lenVarUsed, string retErrVarName)
|
||||
{
|
||||
const string bitVarName = "bits";
|
||||
|
||||
container.Declarations.Add(new VariableDeclaration(new VariableType(bitVarName, LwipDefs.Vt_U32)));
|
||||
|
||||
IfThenElse ite = new IfThenElse(String.Format(
|
||||
"snmp_decode_bits(({0} *){1}, {2}, &{3}) == ERR_OK",
|
||||
LwipDefs.Vt_U8,
|
||||
valueVarName,
|
||||
lenVarName,
|
||||
bitVarName));
|
||||
|
||||
valueVarUsed = true;
|
||||
lenVarUsed = true;
|
||||
|
||||
ite.AddElement(new Comment(String.Format("TODO: store new value contained in '{0}' here", bitVarName), singleLine: true));
|
||||
|
||||
container.AddElement(ite);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using CCodeGeneration;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public class SnmpScalarNodeCounter64 : SnmpScalarNode
|
||||
{
|
||||
public SnmpScalarNodeCounter64(SnmpTreeNode parentNode)
|
||||
: base(parentNode)
|
||||
{
|
||||
this.DataType = SnmpDataType.Counter64;
|
||||
}
|
||||
|
||||
protected override bool GenerateValueDeclaration(CodeContainerBase container, string variableName, string sourceName)
|
||||
{
|
||||
container.AddDeclaration(new VariableDeclaration(
|
||||
new VariableType(variableName + "_high", LwipDefs.Vt_U32, "*"),
|
||||
"(" + new VariableType(null, LwipDefs.Vt_U32, "*").ToString() + ")" + sourceName));
|
||||
container.AddDeclaration(new VariableDeclaration(
|
||||
new VariableType(variableName + "_low", LwipDefs.Vt_U32, "*"),
|
||||
variableName + "_high + 1"));
|
||||
|
||||
container.AddCode(String.Format("LWIP_UNUSED_ARG({0}_high);", variableName));
|
||||
container.AddCode(String.Format("LWIP_UNUSED_ARG({0}_low);", variableName));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override string FixedValueLength
|
||||
{
|
||||
get { return String.Format("(2 * sizeof({0}))", LwipDefs.Vt_U32); }
|
||||
}
|
||||
|
||||
public override int OidRepresentationLen
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using CCodeGeneration;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public class SnmpScalarNodeInt : SnmpScalarNode
|
||||
{
|
||||
public SnmpScalarNodeInt(SnmpTreeNode parentNode)
|
||||
: base(parentNode)
|
||||
{
|
||||
this.DataType = SnmpDataType.Integer;
|
||||
}
|
||||
|
||||
protected override void GenerateTestMethodCodeCore(CodeContainerBase container, string localValueVarName, ref bool localValueVarUsed, string lenVarName, ref bool lenVarUsed, string retErrVarName)
|
||||
{
|
||||
System.Diagnostics.Trace.Assert(this.Restrictions.Count > 0);
|
||||
|
||||
StringBuilder ifCond = new StringBuilder();
|
||||
foreach (IRestriction restriction in this.Restrictions)
|
||||
{
|
||||
ifCond.Append(restriction.GetCheckCodeValid("*" + localValueVarName));
|
||||
ifCond.Append(" || ");
|
||||
|
||||
localValueVarUsed = true;
|
||||
}
|
||||
|
||||
ifCond.Length -= 4;
|
||||
|
||||
IfThenElse ite = new IfThenElse(ifCond.ToString());
|
||||
ite.AddCode(String.Format("{0} = {1};", retErrVarName, LwipDefs.Def_ErrorCode_Ok));
|
||||
container.AddElement(ite);
|
||||
}
|
||||
|
||||
protected override bool GenerateValueDeclaration(CodeContainerBase container, string variableName, string sourceName)
|
||||
{
|
||||
container.AddDeclaration(new VariableDeclaration(
|
||||
new VariableType(variableName, LwipDefs.Vt_S32, "*"),
|
||||
"(" + new VariableType(null, LwipDefs.Vt_S32, "*") + ")" + sourceName));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override string FixedValueLength
|
||||
{
|
||||
get { return String.Format("sizeof({0})", LwipDefs.Vt_S32); }
|
||||
}
|
||||
|
||||
public override int OidRepresentationLen
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,90 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using CCodeGeneration;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public class SnmpScalarNodeObjectIdentifier: SnmpScalarNode
|
||||
{
|
||||
public SnmpScalarNodeObjectIdentifier(SnmpTreeNode parentNode)
|
||||
: base(parentNode)
|
||||
{
|
||||
this.DataType = SnmpDataType.ObjectIdentifier;
|
||||
}
|
||||
|
||||
protected override bool GenerateValueDeclaration(CodeContainerBase container, string variableName, string sourceName)
|
||||
{
|
||||
container.AddDeclaration(new VariableDeclaration(
|
||||
new VariableType(variableName, LwipDefs.Vt_U32, "*"),
|
||||
"(" + new VariableType(null, LwipDefs.Vt_U32, "*") + ")" + sourceName));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void GenerateGetMethodCodeCore(CodeContainerBase container, string localValueVarName, ref bool localValueVarUsed, string retLenVarName)
|
||||
{
|
||||
container.AddElement(new Comment(String.Format("TODO: put requested value to '*{0}' here. '{0}' has to be interpreted as {1}[]", localValueVarName, LwipDefs.Vt_U32), singleLine: true));
|
||||
container.AddElement(EmptyLine.SingleLine);
|
||||
container.AddCode(String.Format("{0} = 0; // TODO: return real value length here (should be 'numOfElements * sizeof({1})')", retLenVarName, LwipDefs.Vt_U32));
|
||||
}
|
||||
|
||||
protected override void GenerateTestMethodCodeCore(CodeContainerBase container, string localValueVarName, ref bool localValueVarUsed, string lenVarName, ref bool lenVarUsed, string retErrVarName)
|
||||
{
|
||||
VariableDeclaration objIdLenVar = new VariableDeclaration(
|
||||
new VariableType(localValueVarName + "_len", LwipDefs.Vt_U8),
|
||||
String.Format("{0} / sizeof({1})", lenVarName, LwipDefs.Vt_U32));
|
||||
lenVarUsed = true;
|
||||
|
||||
container.Declarations.Add(objIdLenVar);
|
||||
|
||||
base.GenerateTestMethodCodeCore(container, localValueVarName, ref localValueVarUsed, lenVarName, ref lenVarUsed, retErrVarName);
|
||||
|
||||
container.AddCode(String.Format("LWIP_UNUSED_ARG({0});", objIdLenVar.Type.Name));
|
||||
}
|
||||
|
||||
protected override void GenerateSetMethodCodeCore(CodeContainerBase container, string localValueVarName, ref bool localValueVarUsed, string lenVarName, ref bool lenVarUsed, string retErrVarName)
|
||||
{
|
||||
VariableDeclaration objIdLenVar = new VariableDeclaration(
|
||||
new VariableType(localValueVarName + "_len", LwipDefs.Vt_U8),
|
||||
String.Format("{0} / sizeof({1})", lenVarName, LwipDefs.Vt_U32));
|
||||
lenVarUsed = true;
|
||||
|
||||
container.Declarations.Add(objIdLenVar);
|
||||
|
||||
base.GenerateSetMethodCodeCore(container, localValueVarName, ref localValueVarUsed, lenVarName, ref lenVarUsed, retErrVarName);
|
||||
|
||||
container.AddCode(String.Format("LWIP_UNUSED_ARG({0});", objIdLenVar.Type.Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using CCodeGeneration;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public class SnmpScalarNodeOctetString : SnmpScalarNode
|
||||
{
|
||||
public SnmpScalarNodeOctetString(SnmpDataType dataType, SnmpTreeNode parentNode)
|
||||
: base(parentNode)
|
||||
{
|
||||
System.Diagnostics.Debug.Assert(
|
||||
(dataType == SnmpDataType.OctetString) ||
|
||||
(dataType == SnmpDataType.Opaque) ||
|
||||
(dataType == SnmpDataType.IpAddress));
|
||||
|
||||
this.DataType = dataType;
|
||||
}
|
||||
|
||||
protected override void GenerateGetMethodCodeCore(CodeContainerBase container, string localValueVarName, ref bool localValueVarUsed, string retLenVarName)
|
||||
{
|
||||
if (this.Restrictions.Count > 0)
|
||||
{
|
||||
StringBuilder ifCond = new StringBuilder();
|
||||
foreach (IRestriction restriction in this.Restrictions)
|
||||
{
|
||||
ifCond.Append(restriction.GetCheckCodeValid(retLenVarName));
|
||||
ifCond.Append(" || ");
|
||||
}
|
||||
|
||||
ifCond.Length -= 4;
|
||||
container.AddElement(new Comment("TODO: take care of len restrictions defined in MIB: " + ifCond, singleLine: true));
|
||||
}
|
||||
base.GenerateGetMethodCodeCore(container, localValueVarName, ref localValueVarUsed, retLenVarName);
|
||||
}
|
||||
|
||||
protected override void GenerateTestMethodCodeCore(CodeContainerBase container, string localValueVarName, ref bool localValueVarUsed, string lenVarName, ref bool lenVarUsed, string retErrVarName)
|
||||
{
|
||||
System.Diagnostics.Trace.Assert(this.Restrictions.Count > 0);
|
||||
|
||||
// checks refer to length of octet string
|
||||
StringBuilder ifCond = new StringBuilder();
|
||||
foreach (IRestriction restriction in this.Restrictions)
|
||||
{
|
||||
ifCond.Append(restriction.GetCheckCodeValid(lenVarName));
|
||||
ifCond.Append(" || ");
|
||||
|
||||
lenVarUsed = true;
|
||||
}
|
||||
|
||||
ifCond.Length -= 4;
|
||||
|
||||
IfThenElse ite = new IfThenElse(ifCond.ToString());
|
||||
ite.AddCode(String.Format("{0} = {1};", retErrVarName, LwipDefs.Def_ErrorCode_Ok));
|
||||
container.AddElement(ite);
|
||||
}
|
||||
|
||||
public override int OidRepresentationLen
|
||||
{
|
||||
get
|
||||
{
|
||||
// check restrictions if we are set to one fixed length
|
||||
if ((this.Restrictions != null) && (this.Restrictions.Count > 0))
|
||||
{
|
||||
foreach (IRestriction restriction in this.Restrictions)
|
||||
{
|
||||
if (restriction is IsInRangeRestriction)
|
||||
{
|
||||
if ((restriction as IsInRangeRestriction).RangeStart == (restriction as IsInRangeRestriction).RangeEnd)
|
||||
{
|
||||
return (int)(restriction as IsInRangeRestriction).RangeStart;
|
||||
}
|
||||
}
|
||||
else if (restriction is IsEqualRestriction)
|
||||
{
|
||||
return (int)(restriction as IsEqualRestriction).Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1; // variable length
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using CCodeGeneration;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public class SnmpScalarNodeTruthValue : SnmpScalarNodeInt
|
||||
{
|
||||
public SnmpScalarNodeTruthValue(SnmpTreeNode parentNode)
|
||||
: base(parentNode)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void GenerateGetMethodCodeCore(CodeContainerBase container, string localValueVarName, ref bool localValueVarUsed, string retLenVarName)
|
||||
{
|
||||
container.AddCodeFormat("snmp_encode_truthvalue({0}, /* TODO: put requested bool value here */ 0);", localValueVarName);
|
||||
localValueVarUsed = true;
|
||||
|
||||
container.AddCode(String.Format("{0} = {1};",
|
||||
retLenVarName,
|
||||
(!String.IsNullOrWhiteSpace(this.FixedValueLength)) ? this.FixedValueLength : "0"));
|
||||
}
|
||||
|
||||
protected override void GenerateSetMethodCodeCore(CodeContainerBase container, string localValueVarName, ref bool localValueVarUsed, string lenVarName, ref bool lenVarUsed, string retErrVarName)
|
||||
{
|
||||
VariableType truthVar = new VariableType("bool_value", LwipDefs.Vt_U8);
|
||||
container.Declarations.Add(new VariableDeclaration(truthVar));
|
||||
|
||||
container.AddCodeFormat("snmp_decode_truthvalue({0}, &{1});", localValueVarName, truthVar.Name);
|
||||
localValueVarUsed = true;
|
||||
|
||||
container.AddElement(new Comment(String.Format("TODO: store new value contained in '{0}' here", truthVar.Name), singleLine: true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using CCodeGeneration;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public class SnmpScalarNodeUint : SnmpScalarNode
|
||||
{
|
||||
public SnmpScalarNodeUint(SnmpDataType dataType, SnmpTreeNode parentNode)
|
||||
: base(parentNode)
|
||||
{
|
||||
System.Diagnostics.Debug.Assert(
|
||||
(dataType == SnmpDataType.Counter) ||
|
||||
(dataType == SnmpDataType.Gauge) ||
|
||||
(dataType == SnmpDataType.TimeTicks));
|
||||
|
||||
this.DataType = dataType;
|
||||
}
|
||||
|
||||
protected override void GenerateTestMethodCodeCore(CodeContainerBase container, string localValueVarName, ref bool localValueVarUsed, string lenVarName, ref bool lenVarUsed, string retErrVarName)
|
||||
{
|
||||
System.Diagnostics.Trace.Assert(this.Restrictions.Count > 0);
|
||||
|
||||
StringBuilder ifCond = new StringBuilder();
|
||||
foreach (IRestriction restriction in this.Restrictions)
|
||||
{
|
||||
ifCond.Append(restriction.GetCheckCodeValid("*" + localValueVarName));
|
||||
ifCond.Append(" || ");
|
||||
|
||||
localValueVarUsed = true;
|
||||
}
|
||||
|
||||
ifCond.Length -= 4;
|
||||
|
||||
IfThenElse ite = new IfThenElse(ifCond.ToString());
|
||||
ite.AddCode(String.Format("{0} = {1};", retErrVarName, LwipDefs.Def_ErrorCode_Ok));
|
||||
container.AddElement(ite);
|
||||
}
|
||||
|
||||
protected override bool GenerateValueDeclaration(CodeContainerBase container, string variableName, string sourceName)
|
||||
{
|
||||
container.AddDeclaration(new VariableDeclaration(
|
||||
new VariableType(variableName, LwipDefs.Vt_U32, "*"),
|
||||
"(" + new VariableType(null, LwipDefs.Vt_U32, "*") + ")" + sourceName));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override string FixedValueLength
|
||||
{
|
||||
get { return String.Format("sizeof({0})", LwipDefs.Vt_U32); }
|
||||
}
|
||||
|
||||
public override int OidRepresentationLen
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,332 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using CCodeGeneration;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public class SnmpTableNode: SnmpScalarAggregationNode
|
||||
{
|
||||
private readonly List<SnmpScalarNode> cellNodes = new List<SnmpScalarNode>();
|
||||
private readonly List<SnmpScalarNode> indexNodes = new List<SnmpScalarNode>();
|
||||
private string augmentedTableRow = null;
|
||||
|
||||
|
||||
public SnmpTableNode(SnmpTreeNode parentNode)
|
||||
: base(parentNode)
|
||||
{
|
||||
}
|
||||
|
||||
public List<SnmpScalarNode> CellNodes
|
||||
{
|
||||
get { return cellNodes; }
|
||||
}
|
||||
|
||||
public List<SnmpScalarNode> IndexNodes
|
||||
{
|
||||
get { return indexNodes; }
|
||||
}
|
||||
|
||||
public string AugmentedTableRow
|
||||
{
|
||||
get { return this.augmentedTableRow; }
|
||||
set { this.augmentedTableRow = value; }
|
||||
}
|
||||
|
||||
public override string FullNodeName
|
||||
{
|
||||
get
|
||||
{
|
||||
string result = this.Name.ToLowerInvariant();
|
||||
if (!result.Contains("table"))
|
||||
{
|
||||
result += "_table";
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
protected override IEnumerable<SnmpScalarNode> AggregatedScalarNodes
|
||||
{
|
||||
get { return this.cellNodes; }
|
||||
}
|
||||
|
||||
public override void GenerateCode(MibCFile mibFile)
|
||||
{
|
||||
FunctionDeclaration getInstanceMethodDecl = new FunctionDeclaration(this.FullNodeName + LwipDefs.FnctSuffix_GetInstance, isStatic: true);
|
||||
getInstanceMethodDecl.Parameter.Add(new VariableType("column", LwipDefs.Vt_U32, "*", ConstType.Value));
|
||||
getInstanceMethodDecl.Parameter.Add(new VariableType("row_oid", LwipDefs.Vt_U32, "*", ConstType.Value));
|
||||
getInstanceMethodDecl.Parameter.Add(new VariableType("row_oid_len", LwipDefs.Vt_U8, ""));
|
||||
getInstanceMethodDecl.Parameter.Add(new VariableType("cell_instance", LwipDefs.Vt_StNodeInstance, "*"));
|
||||
getInstanceMethodDecl.ReturnType = new VariableType(null, LwipDefs.Vt_Snmp_err);
|
||||
mibFile.Declarations.Add(getInstanceMethodDecl);
|
||||
|
||||
Function getInstanceMethod = Function.FromDeclaration(getInstanceMethodDecl);
|
||||
GenerateGetInstanceMethodCode(getInstanceMethod);
|
||||
mibFile.Implementation.Add(getInstanceMethod);
|
||||
|
||||
|
||||
FunctionDeclaration getNextInstanceMethodDecl = new FunctionDeclaration(this.FullNodeName + LwipDefs.FnctSuffix_GetNextInstance, isStatic: true);
|
||||
getNextInstanceMethodDecl.Parameter.Add(new VariableType("column", LwipDefs.Vt_U32, "*", ConstType.Value));
|
||||
getNextInstanceMethodDecl.Parameter.Add(new VariableType("row_oid", LwipDefs.Vt_StObjectId, "*"));
|
||||
getNextInstanceMethodDecl.Parameter.Add(new VariableType("cell_instance", LwipDefs.Vt_StNodeInstance, "*"));
|
||||
getNextInstanceMethodDecl.ReturnType = new VariableType(null, LwipDefs.Vt_Snmp_err);
|
||||
mibFile.Declarations.Add(getNextInstanceMethodDecl);
|
||||
|
||||
Function getNextInstanceMethod = Function.FromDeclaration(getNextInstanceMethodDecl);
|
||||
GenerateGetNextInstanceMethodCode(getNextInstanceMethod);
|
||||
mibFile.Implementation.Add(getNextInstanceMethod);
|
||||
|
||||
|
||||
VariableType instanceType = new VariableType("cell_instance", LwipDefs.Vt_StNodeInstance, "*");
|
||||
GenerateAggregatedCode(
|
||||
mibFile,
|
||||
instanceType,
|
||||
String.Format("SNMP_TABLE_GET_COLUMN_FROM_OID({0}->instance_oid.id)", instanceType.Name));
|
||||
|
||||
|
||||
#region create and add column/table definitions
|
||||
|
||||
StringBuilder colDefs = new StringBuilder();
|
||||
foreach (SnmpScalarNode colNode in this.cellNodes)
|
||||
{
|
||||
colDefs.AppendFormat(" {{{0}, {1}, {2}}}, /* {3} */ \n",
|
||||
colNode.Oid,
|
||||
LwipDefs.GetAsn1DefForSnmpDataType(colNode.DataType),
|
||||
LwipDefs.GetLwipDefForSnmpAccessMode(colNode.AccessMode),
|
||||
colNode.Name);
|
||||
}
|
||||
if (colDefs.Length > 0)
|
||||
{
|
||||
colDefs.Length--;
|
||||
}
|
||||
|
||||
VariableDeclaration colDefsDecl = new VariableDeclaration(
|
||||
new VariableType(this.FullNodeName + "_columns", LwipDefs.Vt_StTableColumnDef, null, ConstType.Value, String.Empty),
|
||||
"{\n" + colDefs + "\n}",
|
||||
isStatic: true);
|
||||
|
||||
mibFile.Declarations.Add(colDefsDecl);
|
||||
|
||||
string nodeInitialization = String.Format("SNMP_TABLE_CREATE({0}, {1}, {2}, {3}, {4}, {5}, {6})",
|
||||
this.Oid,
|
||||
colDefsDecl.Type.Name,
|
||||
getInstanceMethodDecl.Name, getNextInstanceMethodDecl.Name,
|
||||
(this.GetMethodRequired) ? this.GetMethodName : LwipDefs.Null,
|
||||
(this.TestMethodRequired) ? this.TestMethodName : LwipDefs.Null,
|
||||
(this.SetMethodRequired) ? this.SetMethodName : LwipDefs.Null
|
||||
);
|
||||
|
||||
mibFile.Declarations.Add(new VariableDeclaration(
|
||||
new VariableType(this.FullNodeName, LwipDefs.Vt_StTableNode, null, ConstType.Value),
|
||||
nodeInitialization,
|
||||
isStatic: true));
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
protected virtual void GenerateGetInstanceMethodCode(Function getInstanceMethod)
|
||||
{
|
||||
VariableDeclaration returnValue = new VariableDeclaration((VariableType)getInstanceMethod.ReturnType.Clone(), LwipDefs.Def_ErrorCode_NoSuchInstance);
|
||||
returnValue.Type.Name = "err";
|
||||
getInstanceMethod.Declarations.Add(returnValue);
|
||||
|
||||
int instanceOidLength = 0;
|
||||
StringBuilder indexColumns = new StringBuilder();
|
||||
foreach (SnmpScalarNode indexNode in this.indexNodes)
|
||||
{
|
||||
if (instanceOidLength >= 0)
|
||||
{
|
||||
if (indexNode.OidRepresentationLen >= 0)
|
||||
{
|
||||
instanceOidLength += indexNode.OidRepresentationLen;
|
||||
}
|
||||
else
|
||||
{
|
||||
// at least one index column has a variable length -> we cannot perform a static check
|
||||
instanceOidLength = -1;
|
||||
}
|
||||
}
|
||||
|
||||
indexColumns.AppendFormat(
|
||||
" {0} ({1}, OID length = {2})\n",
|
||||
indexNode.Name,
|
||||
indexNode.DataType,
|
||||
(indexNode.OidRepresentationLen >= 0) ? indexNode.OidRepresentationLen.ToString() : "variable");
|
||||
}
|
||||
if (indexColumns.Length > 0)
|
||||
{
|
||||
indexColumns.Length--;
|
||||
|
||||
getInstanceMethod.Declarations.Insert(0, new Comment(String.Format(
|
||||
"The instance OID of this table consists of following (index) column(s):\n{0}",
|
||||
indexColumns)));
|
||||
}
|
||||
|
||||
string augmentsHint = "";
|
||||
if (!String.IsNullOrWhiteSpace(this.augmentedTableRow))
|
||||
{
|
||||
augmentsHint = String.Format(
|
||||
"This table augments table '{0}'! Index columns therefore belong to table '{0}'!\n" +
|
||||
"You may simply call the '*{1}' method of this table.\n\n",
|
||||
(this.augmentedTableRow.ToLowerInvariant().EndsWith("entry")) ? this.augmentedTableRow.Substring(0, this.augmentedTableRow.Length-5) : this.augmentedTableRow,
|
||||
LwipDefs.FnctSuffix_GetInstance);
|
||||
}
|
||||
|
||||
CodeContainerBase ccb = getInstanceMethod;
|
||||
if (instanceOidLength > 0)
|
||||
{
|
||||
IfThenElse ite = new IfThenElse(String.Format("{0} == {1}", getInstanceMethod.Parameter[2].Name, instanceOidLength));
|
||||
getInstanceMethod.AddElement(ite);
|
||||
ccb = ite;
|
||||
}
|
||||
|
||||
ccb.AddCodeFormat("LWIP_UNUSED_ARG({0});", getInstanceMethod.Parameter[0].Name);
|
||||
ccb.AddCodeFormat("LWIP_UNUSED_ARG({0});", getInstanceMethod.Parameter[1].Name);
|
||||
if (instanceOidLength <= 0)
|
||||
{
|
||||
ccb.AddCodeFormat("LWIP_UNUSED_ARG({0});", getInstanceMethod.Parameter[2].Name);
|
||||
}
|
||||
ccb.AddCodeFormat("LWIP_UNUSED_ARG({0});", getInstanceMethod.Parameter[3].Name);
|
||||
|
||||
ccb.AddElement(new Comment(String.Format(
|
||||
"TODO: check if '{0}'/'{1}' params contain a valid instance oid for a row\n" +
|
||||
"If so, set '{2} = {3};'\n\n" +
|
||||
"snmp_oid_* methods may be used for easier processing of oid\n\n" +
|
||||
"{4}" +
|
||||
"In order to avoid decoding OID a second time in subsequent get_value/set_test/set_value methods,\n" +
|
||||
"you may store an arbitrary value (like a pointer to target value object) in '{5}->reference'/'{5}->reference_len'.\n" +
|
||||
"But be aware that not always a subsequent method is called -> Do NOT allocate memory here and try to release it in subsequent methods!\n\n" +
|
||||
"You also may replace function pointers in '{5}' param for get/test/set methods which contain the default values from table definition,\n" +
|
||||
"in order to provide special methods, for the currently processed cell. Changed pointers are only valid for current request.",
|
||||
getInstanceMethod.Parameter[1].Name,
|
||||
getInstanceMethod.Parameter[2].Name,
|
||||
returnValue.Type.Name,
|
||||
LwipDefs.Def_ErrorCode_Ok,
|
||||
augmentsHint,
|
||||
getInstanceMethod.Parameter[3].Name
|
||||
)));
|
||||
|
||||
getInstanceMethod.AddCodeFormat("return {0};", returnValue.Type.Name);
|
||||
}
|
||||
|
||||
protected virtual void GenerateGetNextInstanceMethodCode(Function getNextInstanceMethod)
|
||||
{
|
||||
getNextInstanceMethod.AddCodeFormat("LWIP_UNUSED_ARG({0});", getNextInstanceMethod.Parameter[0].Name);
|
||||
getNextInstanceMethod.AddCodeFormat("LWIP_UNUSED_ARG({0});", getNextInstanceMethod.Parameter[1].Name);
|
||||
getNextInstanceMethod.AddCodeFormat("LWIP_UNUSED_ARG({0});", getNextInstanceMethod.Parameter[2].Name);
|
||||
|
||||
VariableDeclaration returnValue = new VariableDeclaration((VariableType)getNextInstanceMethod.ReturnType.Clone(), LwipDefs.Def_ErrorCode_NoSuchInstance);
|
||||
returnValue.Type.Name = "err";
|
||||
getNextInstanceMethod.Declarations.Add(returnValue);
|
||||
|
||||
StringBuilder indexColumns = new StringBuilder();
|
||||
foreach (SnmpScalarNode indexNode in this.indexNodes)
|
||||
{
|
||||
indexColumns.AppendFormat(
|
||||
" {0} ({1}, OID length = {2})\n",
|
||||
indexNode.Name,
|
||||
indexNode.DataType,
|
||||
(indexNode.OidRepresentationLen >= 0) ? indexNode.OidRepresentationLen.ToString() : "variable");
|
||||
}
|
||||
if (indexColumns.Length > 0)
|
||||
{
|
||||
indexColumns.Length--;
|
||||
|
||||
getNextInstanceMethod.Declarations.Insert(0, new Comment(String.Format(
|
||||
"The instance OID of this table consists of following (index) column(s):\n{0}",
|
||||
indexColumns)));
|
||||
}
|
||||
|
||||
string augmentsHint = "";
|
||||
if (!String.IsNullOrWhiteSpace(this.augmentedTableRow))
|
||||
{
|
||||
augmentsHint = String.Format(
|
||||
"This table augments table '{0}'! Index columns therefore belong to table '{0}'!\n" +
|
||||
"You may simply call the '*{1}' method of this table.\n\n",
|
||||
(this.augmentedTableRow.ToLowerInvariant().EndsWith("entry")) ? this.augmentedTableRow.Substring(0, this.augmentedTableRow.Length-5) : this.augmentedTableRow,
|
||||
LwipDefs.FnctSuffix_GetNextInstance);
|
||||
}
|
||||
|
||||
getNextInstanceMethod.AddElement(new Comment(String.Format(
|
||||
"TODO: analyze '{0}->id'/'{0}->len' and return the subsequent row instance\n" +
|
||||
"Be aware that '{0}->id'/'{0}->len' must not point to a valid instance or have correct instance length.\n" +
|
||||
"If '{0}->len' is 0, return the first instance. If '{0}->len' is longer than expected, cut superfluous OID parts.\n" +
|
||||
"If a valid next instance is found, store it in '{0}->id'/'{0}->len' and set '{1} = {2};'\n\n" +
|
||||
"snmp_oid_* methods may be used for easier processing of oid\n\n" +
|
||||
"{3}" +
|
||||
"In order to avoid decoding OID a second time in subsequent get_value/set_test/set_value methods,\n" +
|
||||
"you may store an arbitrary value (like a pointer to target value object) in '{4}->reference'/'{4}->reference_len'.\n" +
|
||||
"But be aware that not always a subsequent method is called -> Do NOT allocate memory here and try to release it in subsequent methods!\n\n" +
|
||||
"You also may replace function pointers in '{4}' param for get/test/set methods which contain the default values from table definition,\n" +
|
||||
"in order to provide special methods, for the currently processed cell. Changed pointers are only valid for current request.",
|
||||
getNextInstanceMethod.Parameter[1].Name,
|
||||
returnValue.Type.Name,
|
||||
LwipDefs.Def_ErrorCode_Ok,
|
||||
augmentsHint,
|
||||
getNextInstanceMethod.Parameter[2].Name
|
||||
)));
|
||||
|
||||
getNextInstanceMethod.AddElement(new Comment(String.Format(
|
||||
"For easier processing and getting the next instance, you may use the 'snmp_next_oid_*' enumerator.\n" +
|
||||
"Simply pass all known instance OID's to it and it returns the next valid one:\n\n" +
|
||||
"{0} state;\n" +
|
||||
"{1} result_buf;\n" +
|
||||
"snmp_next_oid_init(&state, {2}->id, {2}->len, result_buf, LWIP_SNMP_OBJ_ID_LEN);\n" +
|
||||
"while ({{not all instances passed}}) {{\n" +
|
||||
" {1} test_oid;\n" +
|
||||
" {{fill test_oid to create instance oid for next instance}}\n" +
|
||||
" snmp_next_oid_check(&state, test_oid->id, test_oid->len, {{target_data_ptr}});\n" +
|
||||
"}}\n" +
|
||||
"if(state.status == SNMP_NEXT_OID_STATUS_SUCCESS) {{\n" +
|
||||
" snmp_oid_assign(row_oid, result_buf->oid, result_buf->len);\n" +
|
||||
" {3}->reference.ptr = state.reference; //==target_data_ptr, for usage in subsequent get/test/set\n" +
|
||||
" {4} = {5};\n" +
|
||||
"}}"
|
||||
,
|
||||
LwipDefs.Vt_StNextOidState,
|
||||
LwipDefs.Vt_StObjectId,
|
||||
getNextInstanceMethod.Parameter[1].Name,
|
||||
getNextInstanceMethod.Parameter[2].Name,
|
||||
returnValue.Type.Name,
|
||||
LwipDefs.Def_ErrorCode_Ok
|
||||
)));
|
||||
|
||||
getNextInstanceMethod.AddCodeFormat("return {0};", returnValue.Type.Name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,242 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2001-2004 Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
||||
* SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
|
||||
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the lwIP TCP/IP stack.
|
||||
*
|
||||
* Author: Martin Hentschel <info@cl-soft.de>
|
||||
*
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using CCodeGeneration;
|
||||
|
||||
namespace LwipSnmpCodeGeneration
|
||||
{
|
||||
public class SnmpTreeNode: SnmpScalarAggregationNode
|
||||
{
|
||||
private readonly List<SnmpNode> childNodes = new List<SnmpNode>();
|
||||
private readonly List<SnmpScalarNode> childScalarNodes = new List<SnmpScalarNode>();
|
||||
private string fullOid = "";
|
||||
|
||||
public SnmpTreeNode(SnmpTreeNode parentNode)
|
||||
: base(parentNode)
|
||||
{
|
||||
}
|
||||
|
||||
public override string FullNodeName
|
||||
{
|
||||
get { return this.Name.ToLowerInvariant() + "_treenode"; }
|
||||
}
|
||||
|
||||
public string FullOid
|
||||
{
|
||||
get { return this.fullOid; }
|
||||
set { this.fullOid = value; }
|
||||
}
|
||||
|
||||
public List<SnmpNode> ChildNodes
|
||||
{
|
||||
get { return this.childNodes; }
|
||||
}
|
||||
|
||||
protected override IEnumerable<SnmpScalarNode> AggregatedScalarNodes
|
||||
{
|
||||
get { return this.childScalarNodes; }
|
||||
}
|
||||
|
||||
private void GenerateAggregatedCode(MibCFile mibFile, bool generateDeclarations, bool generateImplementations)
|
||||
{
|
||||
VariableType instanceType = new VariableType("instance", LwipDefs.Vt_StNodeInstance, "*");
|
||||
base.GenerateAggregatedCode(
|
||||
mibFile,
|
||||
instanceType,
|
||||
String.Format("{0}->node->oid", instanceType.Name),
|
||||
generateDeclarations,
|
||||
generateImplementations);
|
||||
}
|
||||
|
||||
private void GenerateAggregateMethodDeclarations(MibCFile mibFile)
|
||||
{
|
||||
if (LwipOpts.GenerateSingleAccessMethodsForTreeNodeScalars && (this.childScalarNodes.Count > 1))
|
||||
{
|
||||
GenerateAggregatedCode(mibFile, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
public override void GenerateCode(MibCFile mibFile)
|
||||
{
|
||||
string nodeInitialization;
|
||||
|
||||
if (LwipOpts.GenerateSingleAccessMethodsForTreeNodeScalars && (this.childScalarNodes.Count > 1))
|
||||
{
|
||||
GenerateAggregatedCode(mibFile, false, true);
|
||||
}
|
||||
|
||||
// create and add node declaration
|
||||
if (this.childNodes.Count > 0)
|
||||
{
|
||||
StringBuilder subnodeArrayInitialization = new StringBuilder();
|
||||
|
||||
for (int i=0; i<this.childNodes.Count; i++)
|
||||
{
|
||||
subnodeArrayInitialization.Append(" &");
|
||||
subnodeArrayInitialization.Append(this.childNodes[i].FullNodeName);
|
||||
subnodeArrayInitialization.Append(".node");
|
||||
if (!(this.childNodes[i] is SnmpTreeNode))
|
||||
{
|
||||
subnodeArrayInitialization.Append(".node");
|
||||
}
|
||||
|
||||
if (i < (this.childNodes.Count - 1))
|
||||
{
|
||||
subnodeArrayInitialization.Append(",\n");
|
||||
}
|
||||
}
|
||||
|
||||
VariableDeclaration subnodeArray = new VariableDeclaration(
|
||||
new VariableType(this.Name.ToLowerInvariant() + "_subnodes", LwipDefs.Vt_StNode, "*", ConstType.Both, String.Empty),
|
||||
"{\n" + subnodeArrayInitialization + "\n}",
|
||||
isStatic: true);
|
||||
|
||||
mibFile.Declarations.Add(subnodeArray);
|
||||
|
||||
nodeInitialization = String.Format("SNMP_CREATE_TREE_NODE({0}, {1})", this.Oid, subnodeArray.Type.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
nodeInitialization = String.Format("SNMP_CREATE_EMPTY_TREE_NODE({0})", this.Oid);
|
||||
}
|
||||
|
||||
mibFile.Declarations.Add(new VariableDeclaration(
|
||||
new VariableType(this.FullNodeName, LwipDefs.Vt_StTreeNode, null, ConstType.Value),
|
||||
nodeInitialization,
|
||||
isStatic: true));
|
||||
}
|
||||
|
||||
public override void Analyze()
|
||||
{
|
||||
this.childScalarNodes.Clear();
|
||||
|
||||
// delegate analyze (don't use enumerator because the child node may change our child collection by e.g. removing or replacing itself)
|
||||
for (int i=this.ChildNodes.Count-1; i>=0; i--)
|
||||
{
|
||||
this.ChildNodes[i].Analyze();
|
||||
}
|
||||
|
||||
// collect scalar nodes
|
||||
foreach (SnmpNode childNode in this.childNodes)
|
||||
{
|
||||
SnmpScalarNode scalarNode = childNode as SnmpScalarNode;
|
||||
if (scalarNode != null)
|
||||
{
|
||||
this.childScalarNodes.Add(scalarNode);
|
||||
}
|
||||
}
|
||||
|
||||
base.Analyze();
|
||||
|
||||
// check if we can merge this node to a scalar array node (all childs need to be scalars)
|
||||
if (this.childNodes.Count > 0)
|
||||
{
|
||||
if (LwipOpts.GenerateScalarArrays && (this.childScalarNodes.Count == this.childNodes.Count) && (this.ParentNode != null))
|
||||
{
|
||||
SnmpScalarArrayNode scalarArrayNode = new SnmpScalarArrayNode(this.childScalarNodes, this.ParentNode);
|
||||
scalarArrayNode.Oid = this.Oid;
|
||||
scalarArrayNode.Name = this.Name;
|
||||
scalarArrayNode.Analyze();
|
||||
|
||||
for (int i=0; i<this.ParentNode.ChildNodes.Count; i++)
|
||||
{
|
||||
if (this.ParentNode.ChildNodes[i] == this)
|
||||
{
|
||||
this.ParentNode.ChildNodes.RemoveAt(i);
|
||||
this.ParentNode.ChildNodes.Insert(i, scalarArrayNode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (LwipOpts.GenerateSingleAccessMethodsForTreeNodeScalars && (this.childScalarNodes.Count > 1))
|
||||
{
|
||||
foreach (SnmpScalarNode scalarNode in this.childScalarNodes)
|
||||
{
|
||||
scalarNode.UseExternalMethods = true;
|
||||
scalarNode.ExternalGetMethod = this.GetMethodName;
|
||||
scalarNode.ExternalTestMethod = this.TestMethodName;
|
||||
scalarNode.ExternalSetMethod = this.SetMethodName;
|
||||
}
|
||||
}
|
||||
}
|
||||
else // if (this.childNodes.Count == 0)
|
||||
{
|
||||
if (!LwipOpts.GenerateEmptyFolders && (this.ParentNode != null))
|
||||
{
|
||||
// do not generate this empty folder because it only waste (static) memory
|
||||
for (int i=0; i<this.ParentNode.ChildNodes.Count; i++)
|
||||
{
|
||||
if (this.ParentNode.ChildNodes[i] == this)
|
||||
{
|
||||
this.ParentNode.ChildNodes.RemoveAt(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Generate(MibCFile generatedFile, MibHeaderFile generatedHeaderFile)
|
||||
{
|
||||
// generate code of child nodes
|
||||
foreach (SnmpNode childNode in this.childNodes)
|
||||
{
|
||||
if (childNode is SnmpTreeNode)
|
||||
{
|
||||
childNode.Generate(generatedFile, generatedHeaderFile);
|
||||
}
|
||||
}
|
||||
|
||||
Comment dividerComment = new Comment(
|
||||
String.Format("--- {0} {1} -----------------------------------------------------", this.Name, this.fullOid),
|
||||
singleLine: true);
|
||||
|
||||
generatedFile.Declarations.Add(dividerComment);
|
||||
generatedFile.Implementation.Add(dividerComment);
|
||||
|
||||
this.GenerateAggregateMethodDeclarations(generatedFile);
|
||||
|
||||
foreach (SnmpNode childNode in this.childNodes)
|
||||
{
|
||||
if (!(childNode is SnmpTreeNode))
|
||||
{
|
||||
childNode.Generate(generatedFile, generatedHeaderFile);
|
||||
}
|
||||
}
|
||||
|
||||
base.Generate(generatedFile, generatedHeaderFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
|
||||
|
||||
IANA-ADDRESS-FAMILY-NUMBERS-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY,
|
||||
mib-2 FROM SNMPv2-SMI
|
||||
TEXTUAL-CONVENTION FROM SNMPv2-TC;
|
||||
|
||||
ianaAddressFamilyNumbers MODULE-IDENTITY
|
||||
LAST-UPDATED "200203140000Z" -- March 14, 2002
|
||||
ORGANIZATION "IANA"
|
||||
CONTACT-INFO
|
||||
"Postal: Internet Assigned Numbers Authority
|
||||
Internet Corporation for Assigned Names
|
||||
and Numbers
|
||||
4676 Admiralty Way, Suite 330
|
||||
Marina del Rey, CA 90292-6601
|
||||
USA
|
||||
|
||||
Tel: +1 310-823-9358
|
||||
E-Mail: iana&iana.org"
|
||||
DESCRIPTION
|
||||
"The MIB module defines the AddressFamilyNumbers
|
||||
textual convention."
|
||||
|
||||
-- revision history
|
||||
|
||||
REVISION "200203140000Z" -- March 14, 2002
|
||||
DESCRIPTION "AddressFamilyNumbers assignment 22 to
|
||||
fibreChannelWWPN. AddressFamilyNumbers
|
||||
assignment 23 to fibreChannelWWNN.
|
||||
AddressFamilyNumers assignment 24 to gwid."
|
||||
|
||||
REVISION "200009080000Z" -- September 8, 2000
|
||||
DESCRIPTION "AddressFamilyNumbers assignment 19 to xtpOverIpv4.
|
||||
AddressFamilyNumbers assignment 20 to xtpOverIpv6.
|
||||
AddressFamilyNumbers assignment 21 to xtpNativeModeXTP."
|
||||
|
||||
REVISION "200003010000Z" -- March 1, 2000
|
||||
DESCRIPTION "AddressFamilyNumbers assignment 17 to distinguishedName.
|
||||
AddressFamilyNumbers assignment 18 to asNumber."
|
||||
|
||||
REVISION "200002040000Z" -- February 4, 2000
|
||||
DESCRIPTION "AddressFamilyNumbers assignment 16 to dns."
|
||||
|
||||
REVISION "9908260000Z" -- August 26, 1999
|
||||
DESCRIPTION "Initial version, published as RFC 2677."
|
||||
|
||||
::= { mib-2 72 }
|
||||
|
||||
|
||||
AddressFamilyNumbers ::= TEXTUAL-CONVENTION
|
||||
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The definition of this textual convention with the
|
||||
addition of newly assigned values is published
|
||||
periodically by the IANA, in either the Assigned
|
||||
Numbers RFC, or some derivative of it specific to
|
||||
Internet Network Management number assignments.
|
||||
(The latest arrangements can be obtained by
|
||||
contacting the IANA.)
|
||||
|
||||
The enumerations are described as:
|
||||
|
||||
other(0), -- none of the following
|
||||
ipV4(1), -- IP Version 4
|
||||
ipV6(2), -- IP Version 6
|
||||
nsap(3), -- NSAP
|
||||
hdlc(4), -- (8-bit multidrop)
|
||||
bbn1822(5),
|
||||
all802(6), -- (includes all 802 media
|
||||
-- plus Ethernet 'canonical format')
|
||||
e163(7),
|
||||
e164(8), -- (SMDS, Frame Relay, ATM)
|
||||
f69(9), -- (Telex)
|
||||
x121(10), -- (X.25, Frame Relay)
|
||||
ipx(11), -- IPX (Internet Protocol Exchange)
|
||||
appleTalk(12), -- Apple Talk
|
||||
decnetIV(13), -- DEC Net Phase IV
|
||||
banyanVines(14), -- Banyan Vines
|
||||
e164withNsap(15),
|
||||
-- (E.164 with NSAP format subaddress)
|
||||
dns(16), -- (Domain Name System)
|
||||
distinguishedName(17), -- (Distinguished Name, per X.500)
|
||||
asNumber(18), -- (16-bit quantity, per the AS number space)
|
||||
xtpOverIpv4(19), -- XTP over IP version 4
|
||||
xtpOverIpv6(20), -- XTP over IP version 6
|
||||
xtpNativeModeXTP(21), -- XTP native mode XTP
|
||||
fibreChannelWWPN(22), -- Fibre Channel World-Wide Port Name
|
||||
fibreChannelWWNN(23), -- Fibre Channel World-Wide Node Name
|
||||
gwid(24), -- Gateway Identifier
|
||||
afi(25), -- AFI for L2VPN information
|
||||
reserved(65535)
|
||||
|
||||
|
||||
|
||||
Requests for new values should be made to IANA via
|
||||
email (iana&iana.org)."
|
||||
|
||||
SYNTAX INTEGER {
|
||||
other(0),
|
||||
ipV4(1),
|
||||
ipV6(2),
|
||||
nsap(3),
|
||||
hdlc(4),
|
||||
bbn1822(5),
|
||||
all802(6),
|
||||
e163(7),
|
||||
e164(8),
|
||||
f69(9),
|
||||
x121(10),
|
||||
ipx(11),
|
||||
appleTalk(12),
|
||||
decnetIV(13),
|
||||
banyanVines(14),
|
||||
e164withNsap(15),
|
||||
dns(16),
|
||||
distinguishedName(17), -- (Distinguished Name, per X.500)
|
||||
asNumber(18), -- (16-bit quantity, per the AS number space)
|
||||
xtpOverIpv4(19),
|
||||
xtpOverIpv6(20),
|
||||
xtpNativeModeXTP(21),
|
||||
fibreChannelWWPN(22),
|
||||
fibreChannelWWNN(23),
|
||||
gwid(24),
|
||||
afi(25),
|
||||
reserved(65535)
|
||||
}
|
||||
END
|
||||
@@ -1,345 +0,0 @@
|
||||
IANA-CHARSET-MIB DEFINITIONS ::= BEGIN
|
||||
-- http://www.iana.org/assignments/ianacharset-mib
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY,
|
||||
mib-2
|
||||
FROM SNMPv2-SMI -- [RFC2578]
|
||||
TEXTUAL-CONVENTION
|
||||
FROM SNMPv2-TC; -- [RFC2579]
|
||||
|
||||
ianaCharsetMIB MODULE-IDENTITY
|
||||
LAST-UPDATED "200705140000Z"
|
||||
ORGANIZATION "IANA"
|
||||
CONTACT-INFO " Internet Assigned Numbers Authority
|
||||
|
||||
Postal: ICANN
|
||||
4676 Admiralty Way, Suite 330
|
||||
Marina del Rey, CA 90292
|
||||
|
||||
Tel: +1 310 823 9358
|
||||
E-Mail: iana&iana.org"
|
||||
|
||||
DESCRIPTION "This MIB module defines the IANACharset
|
||||
TEXTUAL-CONVENTION. The IANACharset TC is used to
|
||||
specify the encoding of string objects defined in
|
||||
a MIB.
|
||||
|
||||
Each version of this MIB will be released based on
|
||||
the IANA Charset Registry file (see RFC 2978) at
|
||||
http://www.iana.org/assignments/character-sets.
|
||||
|
||||
Note: The IANACharset TC, originally defined in
|
||||
RFC 1759, was inaccurately named CodedCharSet.
|
||||
|
||||
Note: Best practice is to define new MIB string
|
||||
objects with invariant UTF-8 (RFC 3629) syntax
|
||||
using the SnmpAdminString TC (defined in RFC 3411)
|
||||
in accordance with IETF Policy on Character Sets and
|
||||
Languages (RFC 2277).
|
||||
|
||||
Copyright (C) The Internet Society (2004). The
|
||||
initial version of this MIB module was published
|
||||
in RFC 3808; for full legal notices see the RFC
|
||||
itself. Supplementary information may be
|
||||
available on
|
||||
http://www.ietf.org/copyrights/ianamib.html."
|
||||
|
||||
-- revision history
|
||||
|
||||
REVISION "200705140000Z"
|
||||
DESCRIPTION "Registration of new charset 2107."
|
||||
|
||||
REVISION "200612070000Z"
|
||||
DESCRIPTION "Registration of new charsets numbered 118, 119,
|
||||
and 2106."
|
||||
|
||||
REVISION "200406080000Z"
|
||||
DESCRIPTION "Original version transferred from Printer MIB,
|
||||
generated from the IANA maintained assignments
|
||||
http://www.iana.org/assignments/character-sets."
|
||||
|
||||
::= { mib-2 106 }
|
||||
|
||||
IANACharset ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Specifies an IANA registered 'charset' - coded character set
|
||||
(CCS) plus optional character encoding scheme (CES) - terms
|
||||
defined in 'IANA Charset Registration Procedures' (RFC 2978).
|
||||
|
||||
Objects of this syntax are used to specify the encoding for
|
||||
string objects defined in one or more MIBs. For example, the
|
||||
prtLocalizationCharacterSet, prtInterpreterDefaultCharSetIn, and
|
||||
prtInterpreterDefaultCharSetOut objects defined in Printer MIB.
|
||||
|
||||
The current list of 'charset' names and enumerated values
|
||||
is contained in the IANA Character Set Registry at:
|
||||
|
||||
http://www.iana.org/assignments/character-sets
|
||||
|
||||
Enum names are derived from the IANA Charset Registry 'Alias'
|
||||
fields that begin with 'cs' (for character set).
|
||||
Enum values are derived from the parallel 'MIBenum' fields."
|
||||
SYNTAX INTEGER {
|
||||
other(1), -- used if the designated
|
||||
-- character set is not currently
|
||||
-- registered by IANA
|
||||
unknown(2), -- used as a default value
|
||||
csASCII(3),
|
||||
csISOLatin1(4),
|
||||
csISOLatin2(5),
|
||||
csISOLatin3(6),
|
||||
csISOLatin4(7),
|
||||
csISOLatinCyrillic(8),
|
||||
csISOLatinArabic(9),
|
||||
csISOLatinGreek(10),
|
||||
csISOLatinHebrew(11),
|
||||
csISOLatin5(12),
|
||||
csISOLatin6(13),
|
||||
csISOTextComm(14),
|
||||
csHalfWidthKatakana(15),
|
||||
csJISEncoding(16),
|
||||
csShiftJIS(17),
|
||||
csEUCPkdFmtJapanese(18),
|
||||
csEUCFixWidJapanese(19),
|
||||
csISO4UnitedKingdom(20),
|
||||
csISO11SwedishForNames(21),
|
||||
csISO15Italian(22),
|
||||
csISO17Spanish(23),
|
||||
csISO21German(24),
|
||||
csISO60DanishNorwegian(25),
|
||||
csISO69French(26),
|
||||
csISO10646UTF1(27),
|
||||
csISO646basic1983(28),
|
||||
csINVARIANT(29),
|
||||
csISO2IntlRefVersion(30),
|
||||
csNATSSEFI(31),
|
||||
csNATSSEFIADD(32),
|
||||
csNATSDANO(33),
|
||||
csNATSDANOADD(34),
|
||||
csISO10Swedish(35),
|
||||
csKSC56011987(36),
|
||||
csISO2022KR(37),
|
||||
csEUCKR(38),
|
||||
csISO2022JP(39),
|
||||
csISO2022JP2(40),
|
||||
csISO13JISC6220jp(41),
|
||||
csISO14JISC6220ro(42),
|
||||
csISO16Portuguese(43),
|
||||
csISO18Greek7Old(44),
|
||||
csISO19LatinGreek(45),
|
||||
csISO25French(46),
|
||||
csISO27LatinGreek1(47),
|
||||
csISO5427Cyrillic(48),
|
||||
csISO42JISC62261978(49),
|
||||
csISO47BSViewdata(50),
|
||||
csISO49INIS(51),
|
||||
csISO50INIS8(52),
|
||||
csISO51INISCyrillic(53),
|
||||
csISO54271981(54),
|
||||
csISO5428Greek(55),
|
||||
csISO57GB1988(56),
|
||||
csISO58GB231280(57),
|
||||
csISO61Norwegian2(58),
|
||||
csISO70VideotexSupp1(59),
|
||||
csISO84Portuguese2(60),
|
||||
csISO85Spanish2(61),
|
||||
csISO86Hungarian(62),
|
||||
csISO87JISX0208(63),
|
||||
csISO88Greek7(64),
|
||||
csISO89ASMO449(65),
|
||||
csISO90(66),
|
||||
csISO91JISC62291984a(67),
|
||||
csISO92JISC62991984b(68),
|
||||
csISO93JIS62291984badd(69),
|
||||
csISO94JIS62291984hand(70),
|
||||
csISO95JIS62291984handadd(71),
|
||||
csISO96JISC62291984kana(72),
|
||||
csISO2033(73),
|
||||
csISO99NAPLPS(74),
|
||||
csISO102T617bit(75),
|
||||
csISO103T618bit(76),
|
||||
csISO111ECMACyrillic(77),
|
||||
csa71(78),
|
||||
csa72(79),
|
||||
csISO123CSAZ24341985gr(80),
|
||||
csISO88596E(81),
|
||||
csISO88596I(82),
|
||||
csISO128T101G2(83),
|
||||
csISO88598E(84),
|
||||
csISO88598I(85),
|
||||
csISO139CSN369103(86),
|
||||
csISO141JUSIB1002(87),
|
||||
csISO143IECP271(88),
|
||||
csISO146Serbian(89),
|
||||
csISO147Macedonian(90),
|
||||
csISO150(91),
|
||||
csISO151Cuba(92),
|
||||
csISO6937Add(93),
|
||||
csISO153GOST1976874(94),
|
||||
csISO8859Supp(95),
|
||||
csISO10367Box(96),
|
||||
csISO158Lap(97),
|
||||
csISO159JISX02121990(98),
|
||||
csISO646Danish(99),
|
||||
csUSDK(100),
|
||||
csDKUS(101),
|
||||
csKSC5636(102),
|
||||
csUnicode11UTF7(103),
|
||||
csISO2022CN(104),
|
||||
csISO2022CNEXT(105),
|
||||
csUTF8(106),
|
||||
csISO885913(109),
|
||||
csISO885914(110),
|
||||
csISO885915(111),
|
||||
csISO885916(112),
|
||||
csGBK(113),
|
||||
csGB18030(114),
|
||||
csOSDEBCDICDF0415(115),
|
||||
csOSDEBCDICDF03IRV(116),
|
||||
csOSDEBCDICDF041(117),
|
||||
csISO115481(118),
|
||||
csKZ1048(119),
|
||||
csUnicode(1000),
|
||||
csUCS4(1001),
|
||||
csUnicodeASCII(1002),
|
||||
csUnicodeLatin1(1003),
|
||||
csUnicodeIBM1261(1005),
|
||||
csUnicodeIBM1268(1006),
|
||||
csUnicodeIBM1276(1007),
|
||||
csUnicodeIBM1264(1008),
|
||||
csUnicodeIBM1265(1009),
|
||||
csUnicode11(1010),
|
||||
csSCSU(1011),
|
||||
csUTF7(1012),
|
||||
csUTF16BE(1013),
|
||||
csUTF16LE(1014),
|
||||
csUTF16(1015),
|
||||
csCESU8(1016),
|
||||
csUTF32(1017),
|
||||
csUTF32BE(1018),
|
||||
csUTF32LE(1019),
|
||||
csBOCU1(1020),
|
||||
csWindows30Latin1(2000),
|
||||
csWindows31Latin1(2001),
|
||||
csWindows31Latin2(2002),
|
||||
csWindows31Latin5(2003),
|
||||
csHPRoman8(2004),
|
||||
csAdobeStandardEncoding(2005),
|
||||
csVenturaUS(2006),
|
||||
csVenturaInternational(2007),
|
||||
csDECMCS(2008),
|
||||
csPC850Multilingual(2009),
|
||||
csPCp852(2010),
|
||||
csPC8CodePage437(2011),
|
||||
csPC8DanishNorwegian(2012),
|
||||
csPC862LatinHebrew(2013),
|
||||
csPC8Turkish(2014),
|
||||
csIBMSymbols(2015),
|
||||
csIBMThai(2016),
|
||||
csHPLegal(2017),
|
||||
csHPPiFont(2018),
|
||||
csHPMath8(2019),
|
||||
csHPPSMath(2020),
|
||||
csHPDesktop(2021),
|
||||
csVenturaMath(2022),
|
||||
csMicrosoftPublishing(2023),
|
||||
csWindows31J(2024),
|
||||
csGB2312(2025),
|
||||
csBig5(2026),
|
||||
csMacintosh(2027),
|
||||
csIBM037(2028),
|
||||
csIBM038(2029),
|
||||
csIBM273(2030),
|
||||
csIBM274(2031),
|
||||
csIBM275(2032),
|
||||
csIBM277(2033),
|
||||
csIBM278(2034),
|
||||
csIBM280(2035),
|
||||
csIBM281(2036),
|
||||
csIBM284(2037),
|
||||
csIBM285(2038),
|
||||
csIBM290(2039),
|
||||
csIBM297(2040),
|
||||
csIBM420(2041),
|
||||
csIBM423(2042),
|
||||
csIBM424(2043),
|
||||
csIBM500(2044),
|
||||
csIBM851(2045),
|
||||
csIBM855(2046),
|
||||
csIBM857(2047),
|
||||
csIBM860(2048),
|
||||
csIBM861(2049),
|
||||
csIBM863(2050),
|
||||
csIBM864(2051),
|
||||
csIBM865(2052),
|
||||
csIBM868(2053),
|
||||
csIBM869(2054),
|
||||
csIBM870(2055),
|
||||
csIBM871(2056),
|
||||
csIBM880(2057),
|
||||
csIBM891(2058),
|
||||
csIBM903(2059),
|
||||
csIBBM904(2060),
|
||||
csIBM905(2061),
|
||||
csIBM918(2062),
|
||||
csIBM1026(2063),
|
||||
csIBMEBCDICATDE(2064),
|
||||
csEBCDICATDEA(2065),
|
||||
csEBCDICCAFR(2066),
|
||||
csEBCDICDKNO(2067),
|
||||
csEBCDICDKNOA(2068),
|
||||
csEBCDICFISE(2069),
|
||||
csEBCDICFISEA(2070),
|
||||
csEBCDICFR(2071),
|
||||
csEBCDICIT(2072),
|
||||
csEBCDICPT(2073),
|
||||
csEBCDICES(2074),
|
||||
csEBCDICESA(2075),
|
||||
csEBCDICESS(2076),
|
||||
csEBCDICUK(2077),
|
||||
csEBCDICUS(2078),
|
||||
csUnknown8BiT(2079),
|
||||
csMnemonic(2080),
|
||||
csMnem(2081),
|
||||
csVISCII(2082),
|
||||
csVIQR(2083),
|
||||
csKOI8R(2084),
|
||||
csHZGB2312(2085),
|
||||
csIBM866(2086),
|
||||
csPC775Baltic(2087),
|
||||
csKOI8U(2088),
|
||||
csIBM00858(2089),
|
||||
csIBM00924(2090),
|
||||
csIBM01140(2091),
|
||||
csIBM01141(2092),
|
||||
csIBM01142(2093),
|
||||
csIBM01143(2094),
|
||||
csIBM01144(2095),
|
||||
csIBM01145(2096),
|
||||
csIBM01146(2097),
|
||||
csIBM01147(2098),
|
||||
csIBM01148(2099),
|
||||
csIBM01149(2100),
|
||||
csBig5HKSCS(2101),
|
||||
csIBM1047(2102),
|
||||
csPTCP154(2103),
|
||||
csAmiga1251(2104),
|
||||
csKOI7switched(2105),
|
||||
csBRF(2106),
|
||||
csTSCII(2107),
|
||||
cswindows1250(2250),
|
||||
cswindows1251(2251),
|
||||
cswindows1252(2252),
|
||||
cswindows1253(2253),
|
||||
cswindows1254(2254),
|
||||
cswindows1255(2255),
|
||||
cswindows1256(2256),
|
||||
cswindows1257(2257),
|
||||
cswindows1258(2258),
|
||||
csTIS620(2259),
|
||||
reserved(3000)
|
||||
}
|
||||
END
|
||||
|
||||
@@ -1,333 +0,0 @@
|
||||
IANA-ITU-ALARM-TC-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY, mib-2 FROM SNMPv2-SMI
|
||||
TEXTUAL-CONVENTION FROM SNMPv2-TC;
|
||||
|
||||
ianaItuAlarmNumbers MODULE-IDENTITY
|
||||
LAST-UPDATED "200409090000Z" -- September 09, 2004
|
||||
ORGANIZATION "IANA"
|
||||
CONTACT-INFO
|
||||
"Postal: Internet Assigned Numbers Authority
|
||||
Internet Corporation for Assigned Names
|
||||
and Numbers
|
||||
4676 Admiralty Way, Suite 330
|
||||
Marina del Rey, CA 90292-6601
|
||||
USA
|
||||
|
||||
Tel: +1 310-823-9358
|
||||
E-Mail: iana&iana.org"
|
||||
DESCRIPTION
|
||||
"The MIB module defines the ITU Alarm
|
||||
textual convention for objects expected to require
|
||||
regular extension.
|
||||
|
||||
Copyright (C) The Internet Society (2004). The
|
||||
initial version of this MIB module was published
|
||||
in RFC 3877. For full legal notices see the RFC
|
||||
itself. Supplementary information may be available on:
|
||||
http://www.ietf.org/copyrights/ianamib.html"
|
||||
REVISION "200409090000Z"
|
||||
DESCRIPTION
|
||||
"Initial version, published as RFC 3877."
|
||||
::= { mib-2 119 }
|
||||
|
||||
|
||||
IANAItuProbableCause ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"ITU-T probable cause values. Duplicate values defined in
|
||||
X.733 are appended with X733 to ensure syntactic uniqueness.
|
||||
Probable cause value 0 is reserved for special purposes.
|
||||
|
||||
The Internet Assigned Number Authority (IANA) is responsible
|
||||
for the assignment of the enumerations in this TC.
|
||||
IANAItuProbableCause value of 0 is reserved for special
|
||||
purposes and MUST NOT be assigned.
|
||||
|
||||
Values of IANAItuProbableCause in the range 1 to 1023 are
|
||||
reserved for causes that correspond to ITU-T probable cause.
|
||||
|
||||
All other requests for new causes will be handled on a
|
||||
first-come, first served basis and will be assigned
|
||||
enumeration values starting with 1025.
|
||||
|
||||
Request should come in the form of well-formed
|
||||
SMI [RFC2578] for enumeration names that are unique and
|
||||
sufficiently descriptive.
|
||||
|
||||
While some effort will be taken to ensure that new probable
|
||||
causes do not conceptually duplicate existing probable
|
||||
causes it is acknowledged that the existence of conceptual
|
||||
duplicates in the starting probable cause list is an known
|
||||
industry reality.
|
||||
|
||||
To aid IANA in the administration of probable cause names
|
||||
and values, the OPS Area Director will appoint one or more
|
||||
experts to help review requests.
|
||||
|
||||
See http://www.iana.org"
|
||||
REFERENCE
|
||||
"ITU Recommendation M.3100, 'Generic Network Information
|
||||
Model', 1995
|
||||
ITU Recommendation X.733, 'Information Technology - Open
|
||||
Systems Interconnection - System Management: Alarm
|
||||
Reporting Function', 1992
|
||||
ITU Recommendation X.736, 'Information Technology - Open
|
||||
Systems Interconnection - System Management: Security
|
||||
Alarm Reporting Function', 1992"
|
||||
|
||||
SYNTAX INTEGER
|
||||
{
|
||||
-- The following probable causes were defined in M.3100
|
||||
aIS (1),
|
||||
callSetUpFailure (2),
|
||||
degradedSignal (3),
|
||||
farEndReceiverFailure (4),
|
||||
framingError (5),
|
||||
lossOfFrame (6),
|
||||
lossOfPointer (7),
|
||||
lossOfSignal (8),
|
||||
payloadTypeMismatch (9),
|
||||
transmissionError (10),
|
||||
remoteAlarmInterface (11),
|
||||
excessiveBER (12),
|
||||
pathTraceMismatch (13),
|
||||
unavailable (14),
|
||||
signalLabelMismatch (15),
|
||||
lossOfMultiFrame (16),
|
||||
receiveFailure (17),
|
||||
transmitFailure (18),
|
||||
modulationFailure (19),
|
||||
demodulationFailure (20),
|
||||
broadcastChannelFailure (21),
|
||||
connectionEstablishmentError (22),
|
||||
invalidMessageReceived (23),
|
||||
localNodeTransmissionError (24),
|
||||
remoteNodeTransmissionError (25),
|
||||
routingFailure (26),
|
||||
--Values 27-50 are reserved for communications alarm related
|
||||
--probable causes
|
||||
-- The following are used with equipment alarm.
|
||||
backplaneFailure (51),
|
||||
dataSetProblem (52),
|
||||
equipmentIdentifierDuplication (53),
|
||||
externalIFDeviceProblem (54),
|
||||
lineCardProblem (55),
|
||||
multiplexerProblem (56),
|
||||
nEIdentifierDuplication (57),
|
||||
powerProblem (58),
|
||||
processorProblem (59),
|
||||
protectionPathFailure (60),
|
||||
receiverFailure (61),
|
||||
replaceableUnitMissing (62),
|
||||
replaceableUnitTypeMismatch (63),
|
||||
synchronizationSourceMismatch (64),
|
||||
terminalProblem (65),
|
||||
timingProblem (66),
|
||||
transmitterFailure (67),
|
||||
trunkCardProblem (68),
|
||||
replaceableUnitProblem (69),
|
||||
realTimeClockFailure (70),
|
||||
--An equipment alarm to be issued if the system detects that the
|
||||
--real time clock has failed
|
||||
antennaFailure (71),
|
||||
batteryChargingFailure (72),
|
||||
diskFailure (73),
|
||||
frequencyHoppingFailure (74),
|
||||
iODeviceError (75),
|
||||
lossOfSynchronisation (76),
|
||||
lossOfRedundancy (77),
|
||||
powerSupplyFailure (78),
|
||||
signalQualityEvaluationFailure (79),
|
||||
tranceiverFailure (80),
|
||||
protectionMechanismFailure (81),
|
||||
protectingResourceFailure (82),
|
||||
-- Values 83-100 are reserved for equipment alarm related probable
|
||||
-- causes
|
||||
-- The following are used with environmental alarm.
|
||||
airCompressorFailure (101),
|
||||
airConditioningFailure (102),
|
||||
airDryerFailure (103),
|
||||
batteryDischarging (104),
|
||||
batteryFailure (105),
|
||||
commercialPowerFailure (106),
|
||||
coolingFanFailure (107),
|
||||
engineFailure (108),
|
||||
fireDetectorFailure (109),
|
||||
fuseFailure (110),
|
||||
generatorFailure (111),
|
||||
lowBatteryThreshold (112),
|
||||
pumpFailure (113),
|
||||
rectifierFailure (114),
|
||||
rectifierHighVoltage (115),
|
||||
rectifierLowFVoltage (116),
|
||||
ventilationsSystemFailure (117),
|
||||
enclosureDoorOpen (118),
|
||||
explosiveGas (119),
|
||||
fire (120),
|
||||
flood (121),
|
||||
highHumidity (122),
|
||||
highTemperature (123),
|
||||
highWind (124),
|
||||
iceBuildUp (125),
|
||||
intrusionDetection (126),
|
||||
lowFuel (127),
|
||||
lowHumidity (128),
|
||||
lowCablePressure (129),
|
||||
lowTemperatue (130),
|
||||
lowWater (131),
|
||||
smoke (132),
|
||||
toxicGas (133),
|
||||
coolingSystemFailure (134),
|
||||
externalEquipmentFailure (135),
|
||||
externalPointFailure (136),
|
||||
-- Values 137-150 are reserved for environmental alarm related
|
||||
-- probable causes
|
||||
-- The following are used with Processing error alarm.
|
||||
storageCapacityProblem (151),
|
||||
memoryMismatch (152),
|
||||
corruptData (153),
|
||||
outOfCPUCycles (154),
|
||||
sfwrEnvironmentProblem (155),
|
||||
sfwrDownloadFailure (156),
|
||||
lossOfRealTimel (157),
|
||||
--A processing error alarm to be issued after the system has
|
||||
--reinitialised. This will indicate
|
||||
--to the management systems that the view they have of the managed
|
||||
--system may no longer
|
||||
--be valid. Usage example: The managed
|
||||
--system issues this alarm after a reinitialization with severity
|
||||
--warning to inform the
|
||||
--management system about the event. No clearing notification will
|
||||
--be sent.
|
||||
applicationSubsystemFailure (158),
|
||||
configurationOrCustomisationError (159),
|
||||
databaseInconsistency (160),
|
||||
fileError (161),
|
||||
outOfMemory (162),
|
||||
softwareError (163),
|
||||
timeoutExpired (164),
|
||||
underlayingResourceUnavailable (165),
|
||||
versionMismatch (166),
|
||||
--Values 168-200 are reserved for processing error alarm related
|
||||
-- probable causes.
|
||||
bandwidthReduced (201),
|
||||
congestion (202),
|
||||
excessiveErrorRate (203),
|
||||
excessiveResponseTime (204),
|
||||
excessiveRetransmissionRate (205),
|
||||
reducedLoggingCapability (206),
|
||||
systemResourcesOverload (207 ),
|
||||
-- The following were defined X.733
|
||||
adapterError (500),
|
||||
applicationSubsystemFailture (501),
|
||||
bandwidthReducedX733 (502),
|
||||
callEstablishmentError (503),
|
||||
communicationsProtocolError (504),
|
||||
communicationsSubsystemFailure (505),
|
||||
configurationOrCustomizationError (506),
|
||||
congestionX733 (507),
|
||||
coruptData (508),
|
||||
cpuCyclesLimitExceeded (509),
|
||||
dataSetOrModemError (510),
|
||||
degradedSignalX733 (511),
|
||||
dteDceInterfaceError (512),
|
||||
enclosureDoorOpenX733 (513),
|
||||
equipmentMalfunction (514),
|
||||
excessiveVibration (515),
|
||||
fileErrorX733 (516),
|
||||
fireDetected (517),
|
||||
framingErrorX733 (518),
|
||||
heatingVentCoolingSystemProblem (519),
|
||||
humidityUnacceptable (520),
|
||||
inputOutputDeviceError (521),
|
||||
inputDeviceError (522),
|
||||
lanError (523),
|
||||
leakDetected (524),
|
||||
localNodeTransmissionErrorX733 (525),
|
||||
lossOfFrameX733 (526),
|
||||
lossOfSignalX733 (527),
|
||||
materialSupplyExhausted (528),
|
||||
multiplexerProblemX733 (529),
|
||||
outOfMemoryX733 (530),
|
||||
ouputDeviceError (531),
|
||||
performanceDegraded (532),
|
||||
powerProblems (533),
|
||||
pressureUnacceptable (534),
|
||||
processorProblems (535),
|
||||
pumpFailureX733 (536),
|
||||
queueSizeExceeded (537),
|
||||
receiveFailureX733 (538),
|
||||
receiverFailureX733 (539),
|
||||
remoteNodeTransmissionErrorX733 (540),
|
||||
resourceAtOrNearingCapacity (541),
|
||||
responseTimeExecessive (542),
|
||||
retransmissionRateExcessive (543),
|
||||
softwareErrorX733 (544),
|
||||
softwareProgramAbnormallyTerminated (545),
|
||||
softwareProgramError (546),
|
||||
storageCapacityProblemX733 (547),
|
||||
temperatureUnacceptable (548),
|
||||
thresholdCrossed (549),
|
||||
timingProblemX733 (550),
|
||||
toxicLeakDetected (551),
|
||||
transmitFailureX733 (552),
|
||||
transmiterFailure (553),
|
||||
underlyingResourceUnavailable (554),
|
||||
versionMismatchX733 (555),
|
||||
-- The following are defined in X.736
|
||||
authenticationFailure (600),
|
||||
breachOfConfidentiality (601),
|
||||
cableTamper (602),
|
||||
delayedInformation (603),
|
||||
denialOfService (604),
|
||||
duplicateInformation (605),
|
||||
informationMissing (606),
|
||||
informationModificationDetected (607),
|
||||
informationOutOfSequence (608),
|
||||
keyExpired (609),
|
||||
nonRepudiationFailure (610),
|
||||
outOfHoursActivity (611),
|
||||
outOfService (612),
|
||||
proceduralError (613),
|
||||
unauthorizedAccessAttempt (614),
|
||||
unexpectedInformation (615),
|
||||
|
||||
other (1024)
|
||||
}
|
||||
|
||||
IANAItuEventType ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The ITU event Type values.
|
||||
|
||||
The Internet Assigned Number Authority (IANA) is
|
||||
responsible for the assignment of the enumerations
|
||||
in this TC.
|
||||
|
||||
Request should come in the form of well-formed
|
||||
SMI [RFC2578] for enumeration names that are unique
|
||||
and sufficiently descriptive.
|
||||
|
||||
See http://www.iana.org "
|
||||
REFERENCE
|
||||
"ITU Recommendation X.736, 'Information Technology - Open
|
||||
Systems Interconnection - System Management: Security
|
||||
Alarm Reporting Function', 1992"
|
||||
SYNTAX INTEGER
|
||||
{
|
||||
other (1),
|
||||
communicationsAlarm (2),
|
||||
qualityOfServiceAlarm (3),
|
||||
processingErrorAlarm (4),
|
||||
equipmentAlarm (5),
|
||||
environmentalAlarm (6),
|
||||
integrityViolation (7),
|
||||
operationalViolation (8),
|
||||
physicalViolation (9),
|
||||
securityServiceOrMechanismViolation (10),
|
||||
timeDomainViolation (11)
|
||||
}
|
||||
|
||||
END
|
||||
@@ -1,127 +0,0 @@
|
||||
|
||||
IANA-LANGUAGE-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY, OBJECT-IDENTITY, mib-2
|
||||
FROM SNMPv2-SMI;
|
||||
|
||||
ianaLanguages MODULE-IDENTITY
|
||||
LAST-UPDATED "200005100000Z" -- May 10, 2000
|
||||
ORGANIZATION "IANA"
|
||||
CONTACT-INFO
|
||||
"Internet Assigned Numbers Authority (IANA)
|
||||
|
||||
Postal: ICANN
|
||||
4676 Admiralty Way, Suite 330
|
||||
Marina del Rey, CA 90292
|
||||
|
||||
Tel: +1 310 823 9358 x20
|
||||
E-Mail: iana&iana.org"
|
||||
DESCRIPTION
|
||||
"The MIB module registers object identifier values for
|
||||
well-known programming and scripting languages. Every
|
||||
language registration MUST describe the format used
|
||||
when transferring scripts written in this language.
|
||||
|
||||
Any additions or changes to the contents of this MIB
|
||||
module require Designated Expert Review as defined in
|
||||
the Guidelines for Writing IANA Considerations Section
|
||||
document. The Designated Expert will be selected by
|
||||
the IESG Area Director of the OPS Area.
|
||||
|
||||
Note, this module does not have to register all possible
|
||||
languages since languages are identified by object
|
||||
identifier values. It is therefore possible to registered
|
||||
languages in private OID trees. The references given below are not
|
||||
normative with regard to the language version. Other
|
||||
references might be better suited to describe some newer
|
||||
versions of this language. The references are only
|
||||
provided as `a pointer into the right direction'."
|
||||
|
||||
-- Revision log, in reverse chronological order
|
||||
|
||||
REVISION "200005100000Z" -- May 10, 2000
|
||||
DESCRIPTION "Import mib-2 instead of experimental, so that
|
||||
this module compiles"
|
||||
|
||||
REVISION "199909090900Z" -- September 9, 1999
|
||||
DESCRIPTION "Initial version as published at time of
|
||||
publication of RFC 2591."
|
||||
|
||||
::= { mib-2 73 }
|
||||
|
||||
|
||||
ianaLangJavaByteCode OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Java byte code to be processed by a Java virtual machine.
|
||||
A script written in Java byte code is transferred by using
|
||||
the Java archive file format (JAR)."
|
||||
REFERENCE
|
||||
"The Java Virtual Machine Specification.
|
||||
ISBN 0-201-63452-X"
|
||||
::= { ianaLanguages 1 }
|
||||
|
||||
ianaLangTcl OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The Tool Command Language (Tcl). A script written in the
|
||||
Tcl language is transferred in Tcl source code format."
|
||||
REFERENCE
|
||||
"Tcl and the Tk Toolkit.
|
||||
ISBN 0-201-63337-X"
|
||||
::= { ianaLanguages 2 }
|
||||
|
||||
ianaLangPerl OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The Perl language. A script written in the Perl language
|
||||
is transferred in Perl source code format."
|
||||
REFERENCE
|
||||
"Programming Perl.
|
||||
ISBN 1-56592-149-6"
|
||||
::= { ianaLanguages 3 }
|
||||
|
||||
ianaLangScheme OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The Scheme language. A script written in the Scheme
|
||||
language is transferred in Scheme source code format."
|
||||
REFERENCE
|
||||
"The Revised^4 Report on the Algorithmic Language Scheme.
|
||||
MIT Press"
|
||||
::= { ianaLanguages 4 }
|
||||
|
||||
ianaLangSRSL OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The SNMP Script Language defined by SNMP Research. A
|
||||
script written in the SNMP Script Language is transferred
|
||||
in the SNMP Script Language source code format."
|
||||
::= { ianaLanguages 5 }
|
||||
|
||||
ianaLangPSL OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The Patrol Script Language defined by BMC Software. A script
|
||||
written in the Patrol Script Language is transferred in the
|
||||
Patrol Script Language source code format."
|
||||
REFERENCE
|
||||
"PATROL Script Language Reference Manual, Version 3.0,
|
||||
November 30, 1995. BMC Software, Inc. 2101 City West Blvd.,
|
||||
Houston, Texas 77042."
|
||||
::= { ianaLanguages 6 }
|
||||
|
||||
ianaLangSMSL OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The Systems Management Scripting Language. A script written
|
||||
in the SMSL language is transferred in the SMSL source code
|
||||
format."
|
||||
REFERENCE
|
||||
"ISO/ITU Command Sequencer.
|
||||
ISO 10164-21 or ITU X.753"
|
||||
::= { ianaLanguages 7 }
|
||||
|
||||
END
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
|
||||
IANA-MALLOC-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY, mib-2 FROM SNMPv2-SMI
|
||||
TEXTUAL-CONVENTION FROM SNMPv2-TC;
|
||||
|
||||
ianaMallocMIB MODULE-IDENTITY
|
||||
LAST-UPDATED "200301271200Z" -- January 27, 2003
|
||||
ORGANIZATION "IANA"
|
||||
CONTACT-INFO
|
||||
" Internet Assigned Numbers Authority
|
||||
Internet Corporation for Assigned Names and Numbers
|
||||
4676 Admiralty Way, Suite 330
|
||||
Marina del Rey, CA 90292-6601
|
||||
|
||||
Phone: +1 310 823 9358
|
||||
EMail: iana&iana.org"
|
||||
DESCRIPTION
|
||||
"This MIB module defines the IANAscopeSource and
|
||||
IANAmallocRangeSource textual conventions for use in MIBs
|
||||
which need to identify ways of learning multicast scope and
|
||||
range information.
|
||||
|
||||
Any additions or changes to the contents of this MIB module
|
||||
require either publication of an RFC, or Designated Expert
|
||||
Review as defined in the Guidelines for Writing IANA
|
||||
Considerations Section document. The Designated Expert will
|
||||
be selected by the IESG Area Director(s) of the Transport
|
||||
Area."
|
||||
|
||||
-- revision log
|
||||
|
||||
REVISION "200301271200Z" -- January 27, 2003
|
||||
DESCRIPTION
|
||||
"Initial version."
|
||||
::= { mib-2 102 }
|
||||
|
||||
IANAscopeSource ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The source of multicast scope information."
|
||||
SYNTAX INTEGER {
|
||||
other(1), -- none of the following
|
||||
manual(2), -- statically configured
|
||||
local(3), -- automatically added by the system,
|
||||
-- such as a Source-Specific Multicast
|
||||
-- scope
|
||||
mzap(4), -- MZAP
|
||||
madcap(5) -- MADCAP
|
||||
}
|
||||
|
||||
IANAmallocRangeSource ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The source of multicast address allocation range
|
||||
information."
|
||||
SYNTAX INTEGER {
|
||||
other(1), -- none of the following
|
||||
manual(2), -- statically configured
|
||||
local(3) -- automatically added by the system,
|
||||
-- such as a Source-Specific Multicast
|
||||
-- range
|
||||
}
|
||||
|
||||
END
|
||||
|
||||
@@ -1,770 +0,0 @@
|
||||
IANA-MAU-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY, OBJECT-IDENTITY, mib-2
|
||||
FROM SNMPv2-SMI
|
||||
TEXTUAL-CONVENTION
|
||||
FROM SNMPv2-TC
|
||||
;
|
||||
|
||||
ianaMauMIB MODULE-IDENTITY
|
||||
LAST-UPDATED "200704210000Z" -- April 21, 2007
|
||||
ORGANIZATION "IANA"
|
||||
CONTACT-INFO " Internet Assigned Numbers Authority
|
||||
|
||||
Postal: ICANN
|
||||
4676 Admiralty Way, Suite 330
|
||||
Marina del Rey, CA 90292
|
||||
|
||||
Tel: +1-310-823-9358
|
||||
EMail: iana&iana.org"
|
||||
|
||||
DESCRIPTION
|
||||
"This MIB module defines dot3MauType OBJECT-IDENTITIES and
|
||||
IANAifMauListBits, IANAifMauMediaAvailable,
|
||||
IANAifMauAutoNegCapBits, and IANAifJackType
|
||||
|
||||
TEXTUAL-CONVENTIONs, specifying enumerated values of the
|
||||
ifMauTypeListBits, ifMauMediaAvailable / rpMauMediaAvailable,
|
||||
ifMauAutoNegCapabilityBits / ifMauAutoNegCapAdvertisedBits /
|
||||
ifMauAutoNegCapReceivedBits and ifJackType / rpJackType objects
|
||||
respectively, defined in the MAU-MIB.
|
||||
|
||||
It is intended that each new MAU type, Media Availability
|
||||
state, Auto Negotiation capability and/or Jack type defined by
|
||||
the IEEE 802.3 working group and approved for publication in a
|
||||
revision of IEEE Std 802.3 will be added to this MIB module,
|
||||
provided that it is suitable for being managed by the base
|
||||
objects in the MAU-MIB. An Expert Review, as defined in
|
||||
RFC 2434 [RFC2434], is REQUIRED for such additions.
|
||||
|
||||
The following reference is used throughout this MIB module:
|
||||
|
||||
[IEEE802.3] refers to:
|
||||
IEEE Std 802.3, 2005 Edition: 'IEEE Standard for
|
||||
Information technology - Telecommunications and information
|
||||
exchange between systems - Local and metropolitan area
|
||||
networks - Specific requirements -
|
||||
Part 3: Carrier sense multiple access with collision
|
||||
detection (CSMA/CD) access method and physical layer
|
||||
specifications'.
|
||||
|
||||
This reference should be updated as appropriate when new
|
||||
MAU types, Media Availability states, Auto Negotiation
|
||||
capabilities, and/or Jack types are added to this MIB module.
|
||||
|
||||
Copyright (C) The IETF Trust (2007).
|
||||
The initial version of this MIB module was published in
|
||||
RFC 4836; for full legal notices see the RFC itself.
|
||||
Supplementary information may be available at:
|
||||
http://www.ietf.org/copyrights/ianamib.html"
|
||||
|
||||
REVISION "200704210000Z" -- April 21, 2007
|
||||
DESCRIPTION "Initial version of this MIB as published in
|
||||
RFC 4836."
|
||||
::= { mib-2 154 }
|
||||
|
||||
-- Textual Conventions
|
||||
|
||||
IANAifMauTypeListBits ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"This data type is used as the syntax of the ifMauTypeListBits
|
||||
object in the (updated) definition of MAU-MIB's ifMauTable.
|
||||
|
||||
The most recent version of this textual convention is available
|
||||
in the online version of this MIB module on the IANA web site.
|
||||
|
||||
Requests for new values should be made to IANA via email
|
||||
(iana&iana.org).
|
||||
|
||||
Note that changes in this textual convention SHALL be
|
||||
synchronized with relevant changes in the dot3MauType
|
||||
OBJECT-IDENTITIES."
|
||||
REFERENCE
|
||||
"[IEEE802.3], Section 30.5.1.1.2"
|
||||
SYNTAX BITS {
|
||||
bOther(0), -- other or unknown
|
||||
bAUI(1), -- AUI
|
||||
b10base5(2), -- 10BASE-5
|
||||
bFoirl(3), -- FOIRL
|
||||
|
||||
b10base2(4), -- 10BASE-2
|
||||
b10baseT(5), -- 10BASE-T duplex mode unknown
|
||||
b10baseFP(6), -- 10BASE-FP
|
||||
b10baseFB(7), -- 10BASE-FB
|
||||
b10baseFL(8), -- 10BASE-FL duplex mode unknown
|
||||
b10broad36(9), -- 10BROAD36
|
||||
b10baseTHD(10), -- 10BASE-T half duplex mode
|
||||
b10baseTFD(11), -- 10BASE-T full duplex mode
|
||||
b10baseFLHD(12), -- 10BASE-FL half duplex mode
|
||||
b10baseFLFD(13), -- 10BASE-FL full duplex mode
|
||||
b100baseT4(14), -- 100BASE-T4
|
||||
b100baseTXHD(15), -- 100BASE-TX half duplex mode
|
||||
b100baseTXFD(16), -- 100BASE-TX full duplex mode
|
||||
b100baseFXHD(17), -- 100BASE-FX half duplex mode
|
||||
b100baseFXFD(18), -- 100BASE-FX full duplex mode
|
||||
b100baseT2HD(19), -- 100BASE-T2 half duplex mode
|
||||
b100baseT2FD(20), -- 100BASE-T2 full duplex mode
|
||||
|
||||
b1000baseXHD(21), -- 1000BASE-X half duplex mode
|
||||
b1000baseXFD(22), -- 1000BASE-X full duplex mode
|
||||
b1000baseLXHD(23), -- 1000BASE-LX half duplex mode
|
||||
b1000baseLXFD(24), -- 1000BASE-LX full duplex mode
|
||||
b1000baseSXHD(25), -- 1000BASE-SX half duplex mode
|
||||
b1000baseSXFD(26), -- 1000BASE-SX full duplex mode
|
||||
b1000baseCXHD(27), -- 1000BASE-CX half duplex mode
|
||||
b1000baseCXFD(28), -- 1000BASE-CX full duplex mode
|
||||
b1000baseTHD(29), -- 1000BASE-T half duplex mode
|
||||
b1000baseTFD(30), -- 1000BASE-T full duplex mode
|
||||
|
||||
b10GbaseX(31), -- 10GBASE-X
|
||||
b10GbaseLX4(32), -- 10GBASE-LX4
|
||||
|
||||
b10GbaseR(33), -- 10GBASE-R
|
||||
b10GbaseER(34), -- 10GBASE-ER
|
||||
b10GbaseLR(35), -- 10GBASE-LR
|
||||
b10GbaseSR(36), -- 10GBASE-SR
|
||||
b10GbaseW(37), -- 10GBASE-W
|
||||
b10GbaseEW(38), -- 10GBASE-EW
|
||||
b10GbaseLW(39), -- 10GBASE-LW
|
||||
b10GbaseSW(40), -- 10GBASE-SW
|
||||
-- new since RFC 3636
|
||||
b10GbaseCX4(41), -- 10GBASE-CX4
|
||||
b2BaseTL(42), -- 2BASE-TL
|
||||
b10PassTS(43), -- 10PASS-TS
|
||||
b100BaseBX10D(44), -- 100BASE-BX10D
|
||||
b100BaseBX10U(45), -- 100BASE-BX10U
|
||||
b100BaseLX10(46), -- 100BASE-LX10
|
||||
b1000BaseBX10D(47), -- 1000BASE-BX10D
|
||||
b1000BaseBX10U(48), -- 1000BASE-BX10U
|
||||
b1000BaseLX10(49), -- 1000BASE-LX10
|
||||
b1000BasePX10D(50), -- 1000BASE-PX10D
|
||||
b1000BasePX10U(51), -- 1000BASE-PX10U
|
||||
b1000BasePX20D(52), -- 1000BASE-PX20D
|
||||
b1000BasePX20U(53) -- 1000BASE-PX20U
|
||||
}
|
||||
|
||||
IANAifMauMediaAvailable ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"This data type is used as the syntax of the
|
||||
ifMauMediaAvailable and rpMauMediaAvailable objects in the
|
||||
(updated) definition of MAU-MIB's ifMauTable and rpMauTable
|
||||
respectively.
|
||||
|
||||
Possible values are:
|
||||
other(1) - undefined (not listed below)
|
||||
unknown(2) - MAU's true state is unknown; e.g.,
|
||||
during initialization
|
||||
available(3) - link, light, or loopback is normal
|
||||
notAvailable(4) - link loss, low light, or no loopback
|
||||
remoteFault(5) - a fault has been detected at the
|
||||
remote end of the link. This value
|
||||
applies to 10BASE-FB, 100BASE-T4 Far
|
||||
End Fault Indication and non-specified
|
||||
remote faults from a system running
|
||||
auto-negotiation
|
||||
invalidSignal(6) - invalid signal has been received from
|
||||
the other end of the link, 10BASE-FB
|
||||
only
|
||||
remoteJabber(7) - remote fault, due to jabber
|
||||
|
||||
remoteLinkLoss(8) - remote fault, due to link loss
|
||||
remoteTest(9) - remote fault, due to test
|
||||
offline(10) - offline, Clause 37 Auto-Negotiation
|
||||
only
|
||||
autoNegError(11) - Auto-Negotiation Error, Clause 37
|
||||
Auto-Negotiation only
|
||||
pmdLinkFault(12) - PMA/PMD receive link fault. In case
|
||||
of PAF (2BASE-TL / 10PASS-TS PHYs),
|
||||
all PMEs in the aggregation group have
|
||||
detected a link fault
|
||||
wisFrameLoss(13) - WIS loss of frame, 10GBASE-W only
|
||||
wisSignalLoss(14) - WIS loss of signal, 10GBASE-W only
|
||||
pcsLinkFault(15) - PCS receive link fault
|
||||
excessiveBER(16) - PCS Bit Error Ratio monitor
|
||||
reporting excessive error ratio
|
||||
dxsLinkFault(17) - DTE XGXS receive link fault, XAUI only
|
||||
pxsLinkFault(18) - PHY XGXS receive link fault, XAUI only
|
||||
availableReduced(19) - link normal, reduced bandwidth,
|
||||
2BASE-TL / 10PASS-TS only
|
||||
ready(20) - at least one PME in the aggregation
|
||||
group is detecting handshake tones,
|
||||
2BASE-TL / 10PASS-TS only
|
||||
|
||||
If the MAU is a 10M b/s link or fiber type (FOIRL, 10BASE-T,
|
||||
10BASE-F), then this is equivalent to the link test fail
|
||||
state/low light function. For an AUI, 10BASE2, 10BASE5, or
|
||||
10BROAD36 MAU, this indicates whether loopback is detected on
|
||||
the DI circuit. The value of this attribute persists between
|
||||
packets for MAU types AUI, 10BASE5, 10BASE2, 10BROAD36, and
|
||||
10BASEFP.
|
||||
|
||||
At power-up or following a reset, the Media Available state
|
||||
will be unknown(2) for AUI, 10BASE5, 10BASE2, 10BROAD36, and
|
||||
10BASE-FP MAUs. For these MAUs loopback will be tested on each
|
||||
transmission during which no collision is detected.
|
||||
If DI is receiving input when DO returns to IDL after a
|
||||
transmission and there has been no collision during the
|
||||
transmission, then loopback will be detected. The Media
|
||||
Available state will only change during noncollided
|
||||
transmissions for AUI, 10BASE2, 10BASE5, 10BROAD36, and
|
||||
10BASE-FP MAUs.
|
||||
|
||||
For 100BASE-T2, 100BASE-T4, 100BASE-TX, 100BASE-FX,
|
||||
100BASE-LX10, and 100BASE-BX10 PHYs the enumerations match the
|
||||
states within the link integrity state diagram.
|
||||
Any MAU that implements management of [IEEE802.3] Clause
|
||||
28 Auto-Negotiation, will map remote fault indication to
|
||||
remoteFault(5).
|
||||
|
||||
Any MAU that implements management of Clause 37
|
||||
Auto-Negotiation, will map the received RF1 and RF2 bits as
|
||||
follows: Offline maps to offline(10), Link_Failure maps to
|
||||
remoteFault(5), and Auto-Negotiation Error maps to
|
||||
autoNegError(11).
|
||||
|
||||
The value remoteFault(5) applies to 10BASE-FB remote
|
||||
fault indication, the 100BASE-X far-end fault indication, and
|
||||
nonspecified remote faults from a system running Clause 28
|
||||
Auto-Negotiation.
|
||||
|
||||
The value remoteJabber(7), remoteLink loss(8), or remoteTest(9)
|
||||
SHOULD be used instead of remoteFault(5) where the reason for
|
||||
remote fault is identified in the remote signaling protocol.
|
||||
Where a Clause 22 MII or Clause 35 GMII is present, a logic
|
||||
one in the remote fault bit maps to the value remoteFault(5),
|
||||
a logic zero in the link status bit maps to the enumeration
|
||||
notAvailable(4). The value notAvailable(4) takes precedence
|
||||
over remoteFault(5).
|
||||
|
||||
For 2BASE-TL and 10PASS-TS PHYs, the value unknown(2) maps to
|
||||
the condition where the PHY (PCS with connected PMEs) is
|
||||
initializing, the value ready(20) maps to the condition where
|
||||
the interface is down and at least one PME in the aggregation
|
||||
group is ready for handshake, the value available(3) maps to
|
||||
the condition where all the PMEs in the aggregation group are
|
||||
up, the value notAvailable(4) maps to the condition where all
|
||||
the PMEs in the aggregation group are down and no handshake
|
||||
tones are detected, the value availableReduced(19) maps to the
|
||||
condition where the interface is up, a link fault is detected
|
||||
at the receive direction by one or more PMEs in the
|
||||
aggregation group, but at least one PME is up and the
|
||||
enumeration pmdLinkFault(12) maps to the condition where a link
|
||||
fault is detected at the receive direction by all of the PMEs
|
||||
in the aggregation group.
|
||||
|
||||
For 10 Gb/s the enumerations map to value of the link_fault
|
||||
variable within the Link Fault Signaling state diagram
|
||||
as follows: the value OK maps to the value available(3),
|
||||
the value Local Fault maps to the value notAvailable(4),
|
||||
and the value Remote Fault maps to the value remoteFault(5).
|
||||
The value pmdLinkFault(12), wisFrameLoss(13),
|
||||
wisSignalLoss(14), pcsLinkFault(15), excessiveBER(16), or
|
||||
dxsLinkFault(17) SHOULD be used instead of the value
|
||||
notAvailable(4), where the reason for the Local Fault state can
|
||||
be identified through the use of the Clause 45 MDIO Interface.
|
||||
Where multiple reasons for the Local Fault state can be
|
||||
identified, only the highest precedence error SHOULD be
|
||||
|
||||
reported. This precedence in descending order is as follows:
|
||||
|
||||
pxsLinkFault
|
||||
pmdLinkFault
|
||||
wisFrameLoss
|
||||
wisSignalLoss
|
||||
pcsLinkFault
|
||||
excessiveBER
|
||||
dxsLinkFault.
|
||||
|
||||
Where a Clause 45 MDIO interface is present a logic zero in
|
||||
the PMA/PMD Receive link status bit ([IEEE802.3]
|
||||
Section 45.2.1.2.2) maps to the value pmdLinkFault(12),
|
||||
logic one in the LOF status bit (Section 45.2.2.10.4) maps
|
||||
to the value wisFrameLoss(13), a logic one in the LOS
|
||||
status bit (Section 45.2.2.10.5) maps to the value
|
||||
wisSignalLoss, a logic zero in the PCS Receive
|
||||
link status bit (Section 45.2.3.2.2) maps to the value
|
||||
pcsLinkFault(15), a logic one in the 10GBASE-R PCS Latched
|
||||
high BER status bit (Section 45.2.3.12.2) maps to the value
|
||||
excessiveBER, a logic zero in the DTE XS receive link status
|
||||
bit (Section 45.2.5.2.2) maps to the value dxsLinkFault(17)
|
||||
and a logic zero in the PHY XS transmit link status bit
|
||||
(Section 45.2.4.2.2) maps to the value pxsLinkFault(18).
|
||||
|
||||
The most recent version of this textual convention is available
|
||||
in the online version of this MIB module on the IANA web site.
|
||||
|
||||
Requests for new values should be made to IANA via email
|
||||
(iana&iana.org)."
|
||||
REFERENCE
|
||||
"[IEEE802.3], Section 30.5.1.1.4"
|
||||
SYNTAX INTEGER {
|
||||
other(1),
|
||||
unknown(2),
|
||||
available(3),
|
||||
notAvailable(4),
|
||||
remoteFault(5),
|
||||
invalidSignal(6),
|
||||
remoteJabber(7),
|
||||
remoteLinkLoss(8),
|
||||
remoteTest(9),
|
||||
offline(10),
|
||||
autoNegError(11),
|
||||
pmdLinkFault(12),
|
||||
wisFrameLoss(13),
|
||||
wisSignalLoss(14),
|
||||
pcsLinkFault(15),
|
||||
|
||||
excessiveBER(16),
|
||||
dxsLinkFault(17),
|
||||
pxsLinkFault(18),
|
||||
availableReduced(19),
|
||||
ready(20)
|
||||
}
|
||||
|
||||
IANAifMauAutoNegCapBits ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"This data type is used as the syntax of the
|
||||
ifMauAutoNegCapabilityBits, ifMauAutoNegCapAdvertisedBits, and
|
||||
ifMauAutoNegCapReceivedBits objects in the (updated) definition
|
||||
of MAU-MIB's ifMauAutoNegTable.
|
||||
|
||||
The most recent version of this textual convention is available
|
||||
in the online version of this MIB module on the IANA web site.
|
||||
|
||||
Requests for new values should be made to IANA via email
|
||||
(iana&iana.org)."
|
||||
REFERENCE
|
||||
"[IEEE802.3], Section 30.6.1.1.5"
|
||||
SYNTAX BITS {
|
||||
bOther(0), -- other or unknown
|
||||
b10baseT(1), -- 10BASE-T half duplex mode
|
||||
b10baseTFD(2), -- 10BASE-T full duplex mode
|
||||
b100baseT4(3), -- 100BASE-T4
|
||||
b100baseTX(4), -- 100BASE-TX half duplex mode
|
||||
b100baseTXFD(5), -- 100BASE-TX full duplex mode
|
||||
b100baseT2(6), -- 100BASE-T2 half duplex mode
|
||||
b100baseT2FD(7), -- 100BASE-T2 full duplex mode
|
||||
bFdxPause(8), -- PAUSE for full-duplex links
|
||||
bFdxAPause(9), -- Asymmetric PAUSE for full-duplex
|
||||
-- links
|
||||
bFdxSPause(10), -- Symmetric PAUSE for full-duplex
|
||||
-- links
|
||||
bFdxBPause(11), -- Asymmetric and Symmetric PAUSE for
|
||||
-- full-duplex links
|
||||
b1000baseX(12), -- 1000BASE-X, -LX, -SX, -CX half
|
||||
-- duplex mode
|
||||
b1000baseXFD(13), -- 1000BASE-X, -LX, -SX, -CX full
|
||||
-- duplex mode
|
||||
b1000baseT(14), -- 1000BASE-T half duplex mode
|
||||
b1000baseTFD(15) -- 1000BASE-T full duplex mode
|
||||
}
|
||||
|
||||
IANAifJackType ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
|
||||
DESCRIPTION
|
||||
"Common enumeration values for repeater and interface MAU
|
||||
jack types. This data type is used as the syntax of the
|
||||
ifJackType and rpJackType objects in the (updated) definition
|
||||
of MAU-MIB's ifJackTable and rpJackTable respectively.
|
||||
|
||||
Possible values are:
|
||||
other(1) - undefined or unknown
|
||||
rj45(2) - RJ45
|
||||
rj45S(3) - RJ45 shielded
|
||||
db9(4) - DB9
|
||||
bnc(5) - BNC
|
||||
fAUI(6) - AUI female
|
||||
mAUI(7) - AUI male
|
||||
fiberSC(8) - SC fiber
|
||||
fiberMIC(9) - MIC fiber
|
||||
fiberST(10) - ST fiber
|
||||
telco(11) - Telco
|
||||
mtrj(12) - MT-RJ fiber
|
||||
hssdc(13) - fiber channel style-2
|
||||
fiberLC(14) - LC fiber
|
||||
cx4(15) - IB4X for 10GBASE-CX4
|
||||
|
||||
The most recent version of this textual convention is available
|
||||
in the online version of this MIB module on the IANA web site.
|
||||
|
||||
Requests for new values should be made to IANA via email
|
||||
(iana&iana.org)."
|
||||
SYNTAX INTEGER {
|
||||
other(1),
|
||||
rj45(2),
|
||||
rj45S(3),
|
||||
db9(4),
|
||||
bnc(5),
|
||||
fAUI(6),
|
||||
mAUI(7),
|
||||
fiberSC(8),
|
||||
fiberMIC(9),
|
||||
fiberST(10),
|
||||
telco(11),
|
||||
mtrj(12),
|
||||
hssdc(13),
|
||||
fiberLC(14),
|
||||
-- new since RFC 3636
|
||||
cx4(15)
|
||||
}
|
||||
|
||||
-- OBJECT IDENTITIES for MAU types
|
||||
|
||||
-- (see rpMauType and ifMauType of MAU-MIB for usage)
|
||||
-- The following definitions has been moved from RFC 3636 and
|
||||
-- no longer appear in its revision.
|
||||
|
||||
dot3MauType OBJECT IDENTIFIER ::= { mib-2 snmpDot3MauMgt(26) 4 }
|
||||
|
||||
dot3MauTypeAUI OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "no internal MAU, view from AUI"
|
||||
REFERENCE "[IEEE802.3], Section 7"
|
||||
::= { dot3MauType 1 }
|
||||
|
||||
dot3MauType10Base5 OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "thick coax MAU"
|
||||
REFERENCE "[IEEE802.3], Section 7"
|
||||
::= { dot3MauType 2 }
|
||||
|
||||
dot3MauTypeFoirl OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "FOIRL MAU"
|
||||
REFERENCE "[IEEE802.3], Section 9.9"
|
||||
::= { dot3MauType 3 }
|
||||
|
||||
dot3MauType10Base2 OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "thin coax MAU"
|
||||
REFERENCE "[IEEE802.3], Section 10"
|
||||
::= { dot3MauType 4 }
|
||||
|
||||
dot3MauType10BaseT OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "UTP MAU.
|
||||
Note that it is strongly recommended that
|
||||
agents return either dot3MauType10BaseTHD or
|
||||
dot3MauType10BaseTFD if the duplex mode is
|
||||
known. However, management applications should
|
||||
be prepared to receive this MAU type value from
|
||||
older agent implementations."
|
||||
REFERENCE "[IEEE802.3], Section 14"
|
||||
::= { dot3MauType 5 }
|
||||
|
||||
dot3MauType10BaseFP OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "passive fiber MAU"
|
||||
REFERENCE "[IEEE802.3], Section 16"
|
||||
::= { dot3MauType 6 }
|
||||
|
||||
dot3MauType10BaseFB OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "sync fiber MAU"
|
||||
REFERENCE "[IEEE802.3], Section 17"
|
||||
::= { dot3MauType 7 }
|
||||
|
||||
dot3MauType10BaseFL OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "async fiber MAU.
|
||||
Note that it is strongly recommended that
|
||||
agents return either dot3MauType10BaseFLHD or
|
||||
dot3MauType10BaseFLFD if the duplex mode is
|
||||
known. However, management applications should
|
||||
be prepared to receive this MAU type value from
|
||||
older agent implementations."
|
||||
REFERENCE "[IEEE802.3], Section 18"
|
||||
::= { dot3MauType 8 }
|
||||
|
||||
dot3MauType10Broad36 OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "broadband DTE MAU.
|
||||
Note that 10BROAD36 MAUs can be attached to
|
||||
interfaces but not to repeaters."
|
||||
REFERENCE "[IEEE802.3], Section 11"
|
||||
::= { dot3MauType 9 }
|
||||
|
||||
------ new since RFC 1515:
|
||||
dot3MauType10BaseTHD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "UTP MAU, half duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 14"
|
||||
::= { dot3MauType 10 }
|
||||
|
||||
dot3MauType10BaseTFD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "UTP MAU, full duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 14"
|
||||
::= { dot3MauType 11 }
|
||||
|
||||
dot3MauType10BaseFLHD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "async fiber MAU, half duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 18"
|
||||
::= { dot3MauType 12 }
|
||||
|
||||
dot3MauType10BaseFLFD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "async fiber MAU, full duplex mode"
|
||||
|
||||
REFERENCE "[IEEE802.3], Section 18"
|
||||
::= { dot3MauType 13 }
|
||||
|
||||
dot3MauType100BaseT4 OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "4 pair category 3 UTP"
|
||||
REFERENCE "[IEEE802.3], Section 23"
|
||||
::= { dot3MauType 14 }
|
||||
|
||||
dot3MauType100BaseTXHD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "2 pair category 5 UTP, half duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 25"
|
||||
::= { dot3MauType 15 }
|
||||
|
||||
dot3MauType100BaseTXFD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "2 pair category 5 UTP, full duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 25"
|
||||
::= { dot3MauType 16 }
|
||||
|
||||
dot3MauType100BaseFXHD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "X fiber over PMT, half duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 26"
|
||||
::= { dot3MauType 17 }
|
||||
|
||||
dot3MauType100BaseFXFD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "X fiber over PMT, full duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 26"
|
||||
::= { dot3MauType 18 }
|
||||
|
||||
dot3MauType100BaseT2HD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "2 pair category 3 UTP, half duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 32"
|
||||
::= { dot3MauType 19 }
|
||||
|
||||
dot3MauType100BaseT2FD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "2 pair category 3 UTP, full duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 32"
|
||||
::= { dot3MauType 20 }
|
||||
|
||||
------ new since RFC 2239:
|
||||
dot3MauType1000BaseXHD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
|
||||
DESCRIPTION "PCS/PMA, unknown PMD, half duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 36"
|
||||
::= { dot3MauType 21 }
|
||||
|
||||
dot3MauType1000BaseXFD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "PCS/PMA, unknown PMD, full duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 36"
|
||||
::= { dot3MauType 22 }
|
||||
|
||||
dot3MauType1000BaseLXHD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "Fiber over long-wavelength laser, half duplex
|
||||
mode"
|
||||
REFERENCE "[IEEE802.3], Section 38"
|
||||
::= { dot3MauType 23 }
|
||||
|
||||
dot3MauType1000BaseLXFD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "Fiber over long-wavelength laser, full duplex
|
||||
mode"
|
||||
REFERENCE "[IEEE802.3], Section 38"
|
||||
::= { dot3MauType 24 }
|
||||
|
||||
dot3MauType1000BaseSXHD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "Fiber over short-wavelength laser, half
|
||||
duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 38"
|
||||
::= { dot3MauType 25 }
|
||||
|
||||
dot3MauType1000BaseSXFD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "Fiber over short-wavelength laser, full
|
||||
duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 38"
|
||||
::= { dot3MauType 26 }
|
||||
|
||||
dot3MauType1000BaseCXHD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "Copper over 150-Ohm balanced cable, half
|
||||
duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 39"
|
||||
::= { dot3MauType 27 }
|
||||
|
||||
dot3MauType1000BaseCXFD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "Copper over 150-Ohm balanced cable, full
|
||||
|
||||
duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 39"
|
||||
::= { dot3MauType 28 }
|
||||
|
||||
dot3MauType1000BaseTHD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "Four-pair Category 5 UTP, half duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 40"
|
||||
::= { dot3MauType 29 }
|
||||
|
||||
dot3MauType1000BaseTFD OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "Four-pair Category 5 UTP, full duplex mode"
|
||||
REFERENCE "[IEEE802.3], Section 40"
|
||||
::= { dot3MauType 30 }
|
||||
|
||||
------ new since RFC 2668:
|
||||
dot3MauType10GigBaseX OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "X PCS/PMA, unknown PMD."
|
||||
REFERENCE "[IEEE802.3], Section 48"
|
||||
::= { dot3MauType 31 }
|
||||
|
||||
dot3MauType10GigBaseLX4 OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "X fiber over WWDM optics"
|
||||
REFERENCE "[IEEE802.3], Section 53"
|
||||
::= { dot3MauType 32 }
|
||||
|
||||
dot3MauType10GigBaseR OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "R PCS/PMA, unknown PMD."
|
||||
REFERENCE "[IEEE802.3], Section 49"
|
||||
::= { dot3MauType 33 }
|
||||
|
||||
dot3MauType10GigBaseER OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "R fiber over 1550 nm optics"
|
||||
REFERENCE "[IEEE802.3], Section 52"
|
||||
::= { dot3MauType 34 }
|
||||
|
||||
dot3MauType10GigBaseLR OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "R fiber over 1310 nm optics"
|
||||
REFERENCE "[IEEE802.3], Section 52"
|
||||
::= { dot3MauType 35 }
|
||||
|
||||
dot3MauType10GigBaseSR OBJECT-IDENTITY
|
||||
|
||||
STATUS current
|
||||
DESCRIPTION "R fiber over 850 nm optics"
|
||||
REFERENCE "[IEEE802.3], Section 52"
|
||||
::= { dot3MauType 36 }
|
||||
|
||||
dot3MauType10GigBaseW OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "W PCS/PMA, unknown PMD."
|
||||
REFERENCE "[IEEE802.3], Section 49 and 50"
|
||||
::= { dot3MauType 37 }
|
||||
|
||||
dot3MauType10GigBaseEW OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "W fiber over 1550 nm optics"
|
||||
REFERENCE "[IEEE802.3], Section 52"
|
||||
::= { dot3MauType 38 }
|
||||
|
||||
dot3MauType10GigBaseLW OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "W fiber over 1310 nm optics"
|
||||
REFERENCE "[IEEE802.3], Section 52"
|
||||
::= { dot3MauType 39 }
|
||||
|
||||
dot3MauType10GigBaseSW OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "W fiber over 850 nm optics"
|
||||
REFERENCE "[IEEE802.3], Section 52"
|
||||
::= { dot3MauType 40 }
|
||||
|
||||
------ new since RFC 3636:
|
||||
dot3MauType10GigBaseCX4 OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "X copper over 8 pair 100-Ohm balanced cable"
|
||||
REFERENCE "[IEEE802.3], Section 54"
|
||||
::= { dot3MauType 41 }
|
||||
|
||||
dot3MauType2BaseTL OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "Voice grade UTP copper, up to 2700m, optional PAF"
|
||||
REFERENCE "[IEEE802.3], Sections 61 and 63"
|
||||
::= { dot3MauType 42 }
|
||||
|
||||
dot3MauType10PassTS OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "Voice grade UTP copper, up to 750m, optional PAF"
|
||||
REFERENCE "[IEEE802.3], Sections 61 and 62"
|
||||
::= { dot3MauType 43 }
|
||||
|
||||
dot3MauType100BaseBX10D OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "One single-mode fiber OLT, long wavelength, 10km"
|
||||
REFERENCE "[IEEE802.3], Section 58"
|
||||
::= { dot3MauType 44 }
|
||||
|
||||
dot3MauType100BaseBX10U OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "One single-mode fiber ONU, long wavelength, 10km"
|
||||
REFERENCE "[IEEE802.3], Section 58"
|
||||
::= { dot3MauType 45 }
|
||||
|
||||
dot3MauType100BaseLX10 OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "Two single-mode fibers, long wavelength, 10km"
|
||||
REFERENCE "[IEEE802.3], Section 58"
|
||||
::= { dot3MauType 46 }
|
||||
|
||||
dot3MauType1000BaseBX10D OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "One single-mode fiber OLT, long wavelength, 10km"
|
||||
REFERENCE "[IEEE802.3], Section 59"
|
||||
::= { dot3MauType 47 }
|
||||
|
||||
dot3MauType1000BaseBX10U OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "One single-mode fiber ONU, long wavelength, 10km"
|
||||
REFERENCE "[IEEE802.3], Section 59"
|
||||
::= { dot3MauType 48 }
|
||||
|
||||
dot3MauType1000BaseLX10 OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "Two sigle-mode fiber, long wavelength, 10km"
|
||||
REFERENCE "[IEEE802.3], Section 59"
|
||||
::= { dot3MauType 49 }
|
||||
|
||||
dot3MauType1000BasePX10D OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "One single-mode fiber EPON OLT, 10km"
|
||||
REFERENCE "[IEEE802.3], Section 60"
|
||||
::= { dot3MauType 50 }
|
||||
|
||||
dot3MauType1000BasePX10U OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "One single-mode fiber EPON ONU, 10km"
|
||||
REFERENCE "[IEEE802.3], Section 60"
|
||||
::= { dot3MauType 51 }
|
||||
|
||||
dot3MauType1000BasePX20D OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "One single-mode fiber EPON OLT, 20km"
|
||||
REFERENCE "[IEEE802.3], Section 60"
|
||||
::= { dot3MauType 52 }
|
||||
|
||||
dot3MauType1000BasePX20U OBJECT-IDENTITY
|
||||
STATUS current
|
||||
DESCRIPTION "One single-mode fiber EPON ONU, 20km"
|
||||
REFERENCE "[IEEE802.3], Section 60"
|
||||
::= { dot3MauType 53 }
|
||||
|
||||
END
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,92 +0,0 @@
|
||||
|
||||
IANA-RTPROTO-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY, mib-2 FROM SNMPv2-SMI
|
||||
TEXTUAL-CONVENTION FROM SNMPv2-TC;
|
||||
|
||||
ianaRtProtoMIB MODULE-IDENTITY
|
||||
LAST-UPDATED "200009260000Z" -- September 26, 2000
|
||||
ORGANIZATION "IANA"
|
||||
CONTACT-INFO
|
||||
" Internet Assigned Numbers Authority
|
||||
Internet Corporation for Assigned Names and Numbers
|
||||
4676 Admiralty Way, Suite 330
|
||||
Marina del Rey, CA 90292-6601
|
||||
|
||||
Phone: +1 310 823 9358
|
||||
EMail: iana&iana.org"
|
||||
DESCRIPTION
|
||||
"This MIB module defines the IANAipRouteProtocol and
|
||||
IANAipMRouteProtocol textual conventions for use in MIBs
|
||||
which need to identify unicast or multicast routing
|
||||
mechanisms.
|
||||
|
||||
Any additions or changes to the contents of this MIB module
|
||||
require either publication of an RFC, or Designated Expert
|
||||
Review as defined in RFC 2434, Guidelines for Writing an
|
||||
IANA Considerations Section in RFCs. The Designated Expert
|
||||
will be selected by the IESG Area Director(s) of the Routing
|
||||
Area."
|
||||
|
||||
REVISION "200009260000Z" -- September 26, 2000
|
||||
DESCRIPTION "Original version, published in coordination
|
||||
with RFC 2932."
|
||||
|
||||
::= { mib-2 84 }
|
||||
|
||||
IANAipRouteProtocol ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
|
||||
DESCRIPTION
|
||||
"A mechanism for learning routes. Inclusion of values for
|
||||
routing protocols is not intended to imply that those
|
||||
protocols need be supported."
|
||||
SYNTAX INTEGER {
|
||||
other (1), -- not specified
|
||||
local (2), -- local interface
|
||||
netmgmt (3), -- static route
|
||||
icmp (4), -- result of ICMP Redirect
|
||||
|
||||
-- the following are all dynamic
|
||||
-- routing protocols
|
||||
|
||||
egp (5), -- Exterior Gateway Protocol
|
||||
ggp (6), -- Gateway-Gateway Protocol
|
||||
hello (7), -- FuzzBall HelloSpeak
|
||||
rip (8), -- Berkeley RIP or RIP-II
|
||||
isIs (9), -- Dual IS-IS
|
||||
esIs (10), -- ISO 9542
|
||||
ciscoIgrp (11), -- Cisco IGRP
|
||||
bbnSpfIgp (12), -- BBN SPF IGP
|
||||
ospf (13), -- Open Shortest Path First
|
||||
bgp (14), -- Border Gateway Protocol
|
||||
idpr (15), -- InterDomain Policy Routing
|
||||
ciscoEigrp (16), -- Cisco EIGRP
|
||||
dvmrp (17) -- DVMRP
|
||||
}
|
||||
|
||||
IANAipMRouteProtocol ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The multicast routing protocol. Inclusion of values for
|
||||
multicast routing protocols is not intended to imply that
|
||||
those protocols need be supported."
|
||||
SYNTAX INTEGER {
|
||||
other(1), -- none of the following
|
||||
local(2), -- e.g., manually configured
|
||||
netmgmt(3), -- set via net.mgmt protocol
|
||||
dvmrp(4),
|
||||
mospf(5),
|
||||
pimSparseDense(6), -- PIMv1, both DM and SM
|
||||
cbt(7),
|
||||
pimSparseMode(8), -- PIM-SM
|
||||
pimDenseMode(9), -- PIM-DM
|
||||
igmpOnly(10),
|
||||
bgmp(11),
|
||||
msdp(12)
|
||||
}
|
||||
|
||||
END
|
||||
|
||||
|
||||
@@ -1,306 +0,0 @@
|
||||
|
||||
IANATn3270eTC-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY, mib-2
|
||||
FROM SNMPv2-SMI
|
||||
TEXTUAL-CONVENTION
|
||||
FROM SNMPv2-TC;
|
||||
|
||||
ianaTn3270eTcMib MODULE-IDENTITY
|
||||
LAST-UPDATED "200005100000Z" -- May 10, 2000
|
||||
ORGANIZATION "IANA"
|
||||
CONTACT-INFO
|
||||
"Internet Assigned Numbers Authority
|
||||
|
||||
Postal: ICANN
|
||||
4676 Admiralty Way, Suite 330
|
||||
Marina del Rey, CA 90292
|
||||
|
||||
Tel: +1 310 823 9358 x20
|
||||
E-Mail: iana&iana.org"
|
||||
DESCRIPTION
|
||||
"This module defines a set of textual conventions
|
||||
for use by the TN3270E-MIB and the TN3270E-RT-MIB.
|
||||
|
||||
Any additions or changes to the contents of this
|
||||
MIB module must first be discussed on the tn3270e
|
||||
working group list at: tn3270e&list.nih.gov
|
||||
and approved by one of the following TN3270E
|
||||
working group contacts:
|
||||
|
||||
Ed Bailey (co-chair) - elbailey&us.ibm.com
|
||||
Michael Boe (co-chair) - mboe&cisco.com
|
||||
Ken White - kennethw&vnet.ibm.com
|
||||
Robert Moore - remoore&us.ibm.com
|
||||
|
||||
The above list of contacts can be altered with
|
||||
the approval of the two co-chairs.
|
||||
|
||||
The Textual Conventions defined within this MIB have
|
||||
no security issues associated with them unless
|
||||
explicitly stated in their corresponding
|
||||
DESCRIPTION clause."
|
||||
|
||||
-- revision log, in reverse chronological order
|
||||
|
||||
REVISION "200005100000Z" -- May 10, 2000
|
||||
DESCRIPTION "Fix to import mib-2 instead of experimental."
|
||||
|
||||
REVISION "199909011000Z" -- September 1, 1999
|
||||
DESCRIPTION
|
||||
"Initial version transferred from the TN3270E
|
||||
working group to IANA."
|
||||
|
||||
::= { mib-2 61 }
|
||||
|
||||
|
||||
-- Textual Conventions
|
||||
|
||||
IANATn3270eAddrType ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The textual convention for defining the type of a
|
||||
client address. The enumeration value unknown(0) is
|
||||
also used to indicate that no actual address is present."
|
||||
SYNTAX INTEGER {
|
||||
unknown(0),
|
||||
ipv4(1),
|
||||
ipv6(2)
|
||||
}
|
||||
|
||||
IANATn3270eAddress ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"Denotes a client address. The type of client address is
|
||||
determined by use of the IANATn3270eAddrType textual
|
||||
convention.
|
||||
The length in octets of a IANATn3270eAddress object is:
|
||||
|
||||
IANATn3270eAddrType Address Length
|
||||
+++++++++++++++++++ ++++++++++++++
|
||||
unknown(0) not specified or unknown; the
|
||||
actual length of the
|
||||
IANATn3270eAddress octet string
|
||||
indicates if an address
|
||||
is present
|
||||
ipv4(1) 4 OCTETS
|
||||
ipv6(2) 16 OCTETS
|
||||
|
||||
This textual convention is similar to the TAddress
|
||||
TC defined by RFC1903 except that it allows a
|
||||
zero-length octet string and is not a full transport
|
||||
layer address."
|
||||
SYNTAX OCTET STRING (SIZE (0..255))
|
||||
|
||||
IANATn3270eClientType ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The textual convention for defining the set of
|
||||
enumerations used by tn3270eTcpConnClientIdFormat
|
||||
in the TN3270E-MIB:
|
||||
|
||||
ENUMERATION OCTETs DESCRIPTION
|
||||
|
||||
none(1) 0 Not specified
|
||||
other(2) 1..512 Implementation specific
|
||||
ipv4(3) 6 4-octet IP Address plus
|
||||
2-octet TCP Port
|
||||
ipv6(4) 18 16-octet IPv6 Address
|
||||
plus 2-octet TCP Port
|
||||
domainName(5) 1..512 The DNS name of a
|
||||
client.
|
||||
truncDomainName(6) 1..512 The (truncated) DNS name
|
||||
of a client.
|
||||
string(7) 1..512 Unknown Utf8String
|
||||
certificate(8) 1..512 certificate
|
||||
userId(9) 1..8 Client's userid
|
||||
x509dn(10) 1..512 X.509 Distinguished Name
|
||||
|
||||
Representation of a certificate(8) may be lead to
|
||||
a security exposure and is NOT RECOMMENDED without
|
||||
adequate security."
|
||||
SYNTAX INTEGER {
|
||||
none(1),
|
||||
other(2),
|
||||
ipv4(3),
|
||||
ipv6(4),
|
||||
domainName(5),
|
||||
truncDomainName(6),
|
||||
string(7),
|
||||
certificate(8),
|
||||
userId(9),
|
||||
x509dn(10)
|
||||
}
|
||||
|
||||
IANATn3270Functions ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"This textual convention reflects the current set of
|
||||
TN3270 and TN3270E functions that can be negotiated
|
||||
between a server and its client:
|
||||
|
||||
RFC856
|
||||
transmitBinary The sender of this command REQUESTS
|
||||
permission to begin transmitting, or
|
||||
confirms that it will now begin
|
||||
transmitting characters which are to
|
||||
be interpreted as 8 bits of binary
|
||||
data by the receiver of the data.
|
||||
RFC860
|
||||
timingMark The sender of this command REQUESTS
|
||||
that the receiver of this command
|
||||
return a WILL TIMING-MARK in the data
|
||||
stream at the 'appropriate place'.
|
||||
RFC885
|
||||
endOfRecord The sender of this command requests
|
||||
permission to begin transmission of
|
||||
the Telnet END-OF-RECORD (EOR) code
|
||||
when transmitting data characters, or
|
||||
the sender of this command confirms it
|
||||
will now begin transmission of EORs
|
||||
with transmitted data characters.
|
||||
RFC1091
|
||||
terminalType Sender is willing to send terminal
|
||||
type information in a subsequent
|
||||
sub-negotiation.
|
||||
|
||||
RFC1041
|
||||
tn3270Regime Sender is willing to send list of
|
||||
supported 3270 Regimes in a
|
||||
subsequent sub-negotiation.
|
||||
RFC2355
|
||||
scsCtlCodes (Printer sessions only). Allows the
|
||||
use of the SNA Character Stream (SCS)
|
||||
and SCS control codes on the session.
|
||||
SCS is used with LU type 1 SNA sessions.
|
||||
dataStreamCtl (Printer sessions only). Allows the use
|
||||
of the standard 3270 data stream. This
|
||||
corresponds to LU type 3 SNA sessions.
|
||||
responses Provides support for positive and
|
||||
negative response handling. Allows the
|
||||
server to reflect to the client any and
|
||||
all definite, exception, and no response
|
||||
requests sent by the host application.
|
||||
bindImage Allows the server to send the SNA Bind
|
||||
image and Unbind notification to the
|
||||
client.
|
||||
sysreq Allows the client and server to emulate
|
||||
some (or all, depending on the server) of
|
||||
the functions of the SYSREQ key in an SNA
|
||||
environment."
|
||||
SYNTAX BITS {
|
||||
transmitBinary(0),-- rfc856
|
||||
timemark(1), -- rfc860
|
||||
endOfRecord(2), -- rfc885
|
||||
terminalType(3), -- rfc1091
|
||||
tn3270Regime(4), -- rfc1041
|
||||
scsCtlCodes(5), -- rfc2355
|
||||
dataStreamCtl(6), -- rfc2355
|
||||
responses(7), -- rfc2355
|
||||
bindImage(8), -- rfc2355
|
||||
sysreq(9) -- rfc2355
|
||||
}
|
||||
|
||||
IANATn3270ResourceType ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The type of resource defined by a resource pool. Refer
|
||||
to tn3270eResPoolTable."
|
||||
SYNTAX INTEGER {
|
||||
other(1),
|
||||
terminal(2),
|
||||
printer(3),
|
||||
terminalOrPrinter(4)
|
||||
}
|
||||
|
||||
IANATn3270DeviceType ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"This textual convention defines the list of device
|
||||
types that can be set, as defined by RFC 2355."
|
||||
SYNTAX INTEGER {
|
||||
-- terminals
|
||||
ibm3278d2(1), -- (24 row x 80 col display)
|
||||
ibm3278d2E(2), -- (24 row x 80 col display)
|
||||
ibm3278d3(3), -- (32 row x 80 col display)
|
||||
ibm3278d3E(4), -- (32 row x 80 col display)
|
||||
ibm3278d4(5), -- (43 row x 80 col display)
|
||||
ibm3278d4E(6), -- (43 row x 80 col display)
|
||||
ibm3278d5(7), -- (27 row x 132 col display)
|
||||
ibm3278d5E(8), -- (27 row x 132 col display)
|
||||
ibmDynamic(9), -- (no pre-defined display size)
|
||||
|
||||
-- printers
|
||||
ibm3287d1(10),
|
||||
|
||||
unknown(100)
|
||||
}
|
||||
|
||||
IANATn3270eLogData ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"An octet string representing log data as pertaining to
|
||||
either a TN3270 or TN3270E Session as reported from a
|
||||
TN3270E Server. Log data is stored in an octet string
|
||||
in time order (from earliest to latest).
|
||||
|
||||
Each log element has the following form:
|
||||
|
||||
+------+----+---------+------------+
|
||||
!length!type!TimeStamp! data !
|
||||
+------+----+---------+------------+
|
||||
|
||||
where
|
||||
|
||||
length = one-octet length of the data portion of the
|
||||
trace element, not including the length,
|
||||
type, and TimeStamp fields
|
||||
type = one-octet code point characterizing the data.
|
||||
TimeStamp = A 4-octet field representing the number of
|
||||
TimeTicks since the TN3270E server was last
|
||||
activated. The server's last activation time
|
||||
is available in the tn3270eSrvrConfLastActTime
|
||||
object in the TN3270E MIB, which has the
|
||||
syntax DateAndTime.
|
||||
data = initial part of a PDU.
|
||||
|
||||
length type
|
||||
|
||||
0-255 x'00' - unknown
|
||||
0 x'01' - inactivity timer expired
|
||||
0 x'02' - dynamic timer expired
|
||||
0 x'03' - actlu req
|
||||
0 x'04' - bind req
|
||||
0 x'05' - clear req
|
||||
0 x'06' - dactlu req
|
||||
0 x'07' - warm actpu req
|
||||
0 x'08' - sdt req
|
||||
0 x'09' - unbind req
|
||||
0 x'0A' - notify resp
|
||||
0 x'0B' - reply PSID neg rsp
|
||||
0 x'0C' - reply PSID pos rsp
|
||||
0 x'0D' - unbind rsp
|
||||
0 x'0E' - hierarchical reset
|
||||
0 x'0F' - client connect req
|
||||
0 x'10' - client disconnect req
|
||||
0 x'11' - timingmark received
|
||||
0 x'12' - flowControl timer expired
|
||||
0 x'13' - neg rsp to host
|
||||
0 x'14' - neg rsp from host
|
||||
0 x'15' - data contention
|
||||
0 x'16' - no buffer to send SNA data
|
||||
0 x'17' - receive response while inbound
|
||||
0 x'18' - client protocol error
|
||||
0 x'19' - badClientSequenceReceived
|
||||
1-255 x'1A' - utf8String
|
||||
2 x'1B' - hexCode, implementation dependent
|
||||
|
||||
Log element entries have a minimum length of 6 octets.
|
||||
The zero-length string indicates that no log data is
|
||||
available."
|
||||
SYNTAX OCTET STRING (SIZE (0 | 6..2048))
|
||||
|
||||
END
|
||||
|
||||
|
||||
@@ -1,572 +0,0 @@
|
||||
IANAifType-MIB DEFINITIONS ::= BEGIN
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY, mib-2 FROM SNMPv2-SMI
|
||||
TEXTUAL-CONVENTION FROM SNMPv2-TC;
|
||||
|
||||
ianaifType MODULE-IDENTITY
|
||||
LAST-UPDATED "200709130000Z" -- September 13, 2007
|
||||
ORGANIZATION "IANA"
|
||||
CONTACT-INFO " Internet Assigned Numbers Authority
|
||||
|
||||
Postal: ICANN
|
||||
4676 Admiralty Way, Suite 330
|
||||
Marina del Rey, CA 90292
|
||||
|
||||
Tel: +1 310 823 9358
|
||||
E-Mail: iana&iana.org"
|
||||
|
||||
DESCRIPTION "This MIB module defines the IANAifType Textual
|
||||
Convention, and thus the enumerated values of
|
||||
the ifType object defined in MIB-II's ifTable."
|
||||
|
||||
REVISION "200709130000Z" -- September 13, 2007
|
||||
DESCRIPTION "Registration of new IANAifTypes 243 and 244."
|
||||
|
||||
REVISION "200705290000Z" -- May 29, 2007
|
||||
DESCRIPTION "Changed the description for IANAifType 228."
|
||||
|
||||
REVISION "200703080000Z" -- March 08, 2007
|
||||
DESCRIPTION "Registration of new IANAifType 242."
|
||||
|
||||
REVISION "200701230000Z" -- January 23, 2007
|
||||
DESCRIPTION "Registration of new IANAifTypes 239, 240, and 241."
|
||||
|
||||
REVISION "200610170000Z" -- October 17, 2006
|
||||
DESCRIPTION "Deprecated/Obsoleted IANAifType 230. Registration of
|
||||
IANAifType 238."
|
||||
|
||||
REVISION "200609250000Z" -- September 25, 2006
|
||||
DESCRIPTION "Changed the description for IANA ifType
|
||||
184 and added new IANA ifType 237."
|
||||
|
||||
REVISION "200608170000Z" -- August 17, 2006
|
||||
DESCRIPTION "Changed the descriptions for IANAifTypes
|
||||
20 and 21."
|
||||
|
||||
REVISION "200608110000Z" -- August 11, 2006
|
||||
DESCRIPTION "Changed the descriptions for IANAifTypes
|
||||
7, 11, 62, 69, and 117."
|
||||
|
||||
REVISION "200607250000Z" -- July 25, 2006
|
||||
DESCRIPTION "Registration of new IANA ifType 236."
|
||||
|
||||
REVISION "200606140000Z" -- June 14, 2006
|
||||
DESCRIPTION "Registration of new IANA ifType 235."
|
||||
|
||||
REVISION "200603310000Z" -- March 31, 2006
|
||||
DESCRIPTION "Registration of new IANA ifType 234."
|
||||
|
||||
REVISION "200603300000Z" -- March 30, 2006
|
||||
DESCRIPTION "Registration of new IANA ifType 233."
|
||||
|
||||
REVISION "200512220000Z" -- December 22, 2005
|
||||
DESCRIPTION "Registration of new IANA ifTypes 231 and 232."
|
||||
|
||||
REVISION "200510100000Z" -- October 10, 2005
|
||||
DESCRIPTION "Registration of new IANA ifType 230."
|
||||
|
||||
REVISION "200509090000Z" -- September 09, 2005
|
||||
DESCRIPTION "Registration of new IANA ifType 229."
|
||||
|
||||
REVISION "200505270000Z" -- May 27, 2005
|
||||
DESCRIPTION "Registration of new IANA ifType 228."
|
||||
|
||||
REVISION "200503030000Z" -- March 3, 2005
|
||||
DESCRIPTION "Added the IANAtunnelType TC and deprecated
|
||||
IANAifType sixToFour (215) per RFC4087."
|
||||
|
||||
REVISION "200411220000Z" -- November 22, 2004
|
||||
DESCRIPTION "Registration of new IANA ifType 227 per RFC4631."
|
||||
|
||||
REVISION "200406170000Z" -- June 17, 2004
|
||||
DESCRIPTION "Registration of new IANA ifType 226."
|
||||
|
||||
REVISION "200405120000Z" -- May 12, 2004
|
||||
DESCRIPTION "Added description for IANAifType 6, and
|
||||
changed the descriptions for IANAifTypes
|
||||
180, 181, and 182."
|
||||
|
||||
REVISION "200405070000Z" -- May 7, 2004
|
||||
DESCRIPTION "Registration of new IANAifType 225."
|
||||
|
||||
REVISION "200308250000Z" -- Aug 25, 2003
|
||||
DESCRIPTION "Deprecated IANAifTypes 7 and 11. Obsoleted
|
||||
IANAifTypes 62, 69, and 117. ethernetCsmacd (6)
|
||||
should be used instead of these values"
|
||||
|
||||
REVISION "200308180000Z" -- Aug 18, 2003
|
||||
DESCRIPTION "Registration of new IANAifType
|
||||
224."
|
||||
|
||||
REVISION "200308070000Z" -- Aug 7, 2003
|
||||
DESCRIPTION "Registration of new IANAifTypes
|
||||
222 and 223."
|
||||
|
||||
REVISION "200303180000Z" -- Mar 18, 2003
|
||||
DESCRIPTION "Registration of new IANAifType
|
||||
221."
|
||||
|
||||
REVISION "200301130000Z" -- Jan 13, 2003
|
||||
DESCRIPTION "Registration of new IANAifType
|
||||
220."
|
||||
|
||||
REVISION "200210170000Z" -- Oct 17, 2002
|
||||
DESCRIPTION "Registration of new IANAifType
|
||||
219."
|
||||
|
||||
REVISION "200207160000Z" -- Jul 16, 2002
|
||||
DESCRIPTION "Registration of new IANAifTypes
|
||||
217 and 218."
|
||||
|
||||
REVISION "200207100000Z" -- Jul 10, 2002
|
||||
DESCRIPTION "Registration of new IANAifTypes
|
||||
215 and 216."
|
||||
|
||||
REVISION "200206190000Z" -- Jun 19, 2002
|
||||
DESCRIPTION "Registration of new IANAifType
|
||||
214."
|
||||
|
||||
REVISION "200201040000Z" -- Jan 4, 2002
|
||||
DESCRIPTION "Registration of new IANAifTypes
|
||||
211, 212 and 213."
|
||||
|
||||
REVISION "200112200000Z" -- Dec 20, 2001
|
||||
DESCRIPTION "Registration of new IANAifTypes
|
||||
209 and 210."
|
||||
|
||||
REVISION "200111150000Z" -- Nov 15, 2001
|
||||
DESCRIPTION "Registration of new IANAifTypes
|
||||
207 and 208."
|
||||
|
||||
|
||||
REVISION "200111060000Z" -- Nov 6, 2001
|
||||
DESCRIPTION "Registration of new IANAifType
|
||||
206."
|
||||
|
||||
|
||||
REVISION "200111020000Z" -- Nov 2, 2001
|
||||
DESCRIPTION "Registration of new IANAifType
|
||||
205."
|
||||
|
||||
|
||||
REVISION "200110160000Z" -- Oct 16, 2001
|
||||
DESCRIPTION "Registration of new IANAifTypes
|
||||
199, 200, 201, 202, 203, and 204."
|
||||
|
||||
|
||||
REVISION "200109190000Z" -- Sept 19, 2001
|
||||
DESCRIPTION "Registration of new IANAifType
|
||||
198."
|
||||
|
||||
REVISION "200105110000Z" -- May 11, 2001
|
||||
DESCRIPTION "Registration of new IANAifType
|
||||
197."
|
||||
|
||||
|
||||
REVISION "200101120000Z" -- Jan 12, 2001
|
||||
DESCRIPTION "Registration of new IANAifTypes
|
||||
195 and 196."
|
||||
|
||||
REVISION "200012190000Z" -- Dec 19, 2000
|
||||
DESCRIPTION "Registration of new IANAifTypes
|
||||
193 and 194."
|
||||
|
||||
REVISION "200012070000Z" -- Dec 07, 2000
|
||||
DESCRIPTION "Registration of new IANAifTypes
|
||||
191 and 192."
|
||||
|
||||
REVISION "200012040000Z" -- Dec 04, 2000
|
||||
DESCRIPTION "Registration of new IANAifType
|
||||
190."
|
||||
|
||||
REVISION "200010170000Z" -- Oct 17, 2000
|
||||
DESCRIPTION "Registration of new IANAifTypes
|
||||
188 and 189."
|
||||
|
||||
REVISION "200010020000Z" -- Oct 02, 2000
|
||||
DESCRIPTION "Registration of new IANAifType 187."
|
||||
|
||||
REVISION "200009010000Z" -- Sept 01, 2000
|
||||
DESCRIPTION "Registration of new IANAifTypes
|
||||
184, 185, and 186."
|
||||
|
||||
REVISION "200008240000Z" -- Aug 24, 2000
|
||||
DESCRIPTION "Registration of new IANAifType 183."
|
||||
|
||||
REVISION "200008230000Z" -- Aug 23, 2000
|
||||
DESCRIPTION "Registration of new IANAifTypes
|
||||
174-182."
|
||||
|
||||
REVISION "200008220000Z" -- Aug 22, 2000
|
||||
DESCRIPTION "Registration of new IANAifTypes 170,
|
||||
171, 172 and 173."
|
||||
|
||||
REVISION "200004250000Z" -- Apr 25, 2000
|
||||
DESCRIPTION "Registration of new IANAifTypes 168 and 169."
|
||||
|
||||
REVISION "200003060000Z" -- Mar 6, 2000
|
||||
DESCRIPTION "Fixed a missing semi-colon in the IMPORT.
|
||||
Also cleaned up the REVISION log a bit.
|
||||
It is not complete, but from now on it will
|
||||
be maintained and kept up to date with each
|
||||
change to this MIB module."
|
||||
|
||||
REVISION "199910081430Z" -- Oct 08, 1999
|
||||
DESCRIPTION "Include new name assignments up to cnr(85).
|
||||
This is the first version available via the WWW
|
||||
at: ftp://ftp.isi.edu/mib/ianaiftype.mib"
|
||||
|
||||
REVISION "199401310000Z" -- Jan 31, 1994
|
||||
DESCRIPTION "Initial version of this MIB as published in
|
||||
RFC 1573."
|
||||
|
||||
::= { mib-2 30 }
|
||||
|
||||
|
||||
IANAifType ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"This data type is used as the syntax of the ifType
|
||||
object in the (updated) definition of MIB-II's
|
||||
ifTable.
|
||||
|
||||
The definition of this textual convention with the
|
||||
addition of newly assigned values is published
|
||||
periodically by the IANA, in either the Assigned
|
||||
Numbers RFC, or some derivative of it specific to
|
||||
Internet Network Management number assignments. (The
|
||||
latest arrangements can be obtained by contacting the
|
||||
IANA.)
|
||||
|
||||
Requests for new values should be made to IANA via
|
||||
email (iana&iana.org).
|
||||
|
||||
The relationship between the assignment of ifType
|
||||
values and of OIDs to particular media-specific MIBs
|
||||
is solely the purview of IANA and is subject to change
|
||||
without notice. Quite often, a media-specific MIB's
|
||||
OID-subtree assignment within MIB-II's 'transmission'
|
||||
subtree will be the same as its ifType value.
|
||||
However, in some circumstances this will not be the
|
||||
case, and implementors must not pre-assume any
|
||||
specific relationship between ifType values and
|
||||
transmission subtree OIDs."
|
||||
SYNTAX INTEGER {
|
||||
other(1), -- none of the following
|
||||
regular1822(2),
|
||||
hdh1822(3),
|
||||
ddnX25(4),
|
||||
rfc877x25(5),
|
||||
ethernetCsmacd(6), -- for all ethernet-like interfaces,
|
||||
-- regardless of speed, as per RFC3635
|
||||
iso88023Csmacd(7), -- Deprecated via RFC3635
|
||||
-- ethernetCsmacd (6) should be used instead
|
||||
iso88024TokenBus(8),
|
||||
iso88025TokenRing(9),
|
||||
iso88026Man(10),
|
||||
starLan(11), -- Deprecated via RFC3635
|
||||
-- ethernetCsmacd (6) should be used instead
|
||||
proteon10Mbit(12),
|
||||
proteon80Mbit(13),
|
||||
hyperchannel(14),
|
||||
fddi(15),
|
||||
lapb(16),
|
||||
sdlc(17),
|
||||
ds1(18), -- DS1-MIB
|
||||
e1(19), -- Obsolete see DS1-MIB
|
||||
basicISDN(20), -- no longer used
|
||||
-- see also RFC2127
|
||||
primaryISDN(21), -- no longer used
|
||||
-- see also RFC2127
|
||||
propPointToPointSerial(22), -- proprietary serial
|
||||
ppp(23),
|
||||
softwareLoopback(24),
|
||||
eon(25), -- CLNP over IP
|
||||
ethernet3Mbit(26),
|
||||
nsip(27), -- XNS over IP
|
||||
slip(28), -- generic SLIP
|
||||
ultra(29), -- ULTRA technologies
|
||||
ds3(30), -- DS3-MIB
|
||||
sip(31), -- SMDS, coffee
|
||||
frameRelay(32), -- DTE only.
|
||||
rs232(33),
|
||||
para(34), -- parallel-port
|
||||
arcnet(35), -- arcnet
|
||||
arcnetPlus(36), -- arcnet plus
|
||||
atm(37), -- ATM cells
|
||||
miox25(38),
|
||||
sonet(39), -- SONET or SDH
|
||||
x25ple(40),
|
||||
iso88022llc(41),
|
||||
localTalk(42),
|
||||
smdsDxi(43),
|
||||
frameRelayService(44), -- FRNETSERV-MIB
|
||||
v35(45),
|
||||
hssi(46),
|
||||
hippi(47),
|
||||
modem(48), -- Generic modem
|
||||
aal5(49), -- AAL5 over ATM
|
||||
sonetPath(50),
|
||||
sonetVT(51),
|
||||
smdsIcip(52), -- SMDS InterCarrier Interface
|
||||
propVirtual(53), -- proprietary virtual/internal
|
||||
propMultiplexor(54),-- proprietary multiplexing
|
||||
ieee80212(55), -- 100BaseVG
|
||||
fibreChannel(56), -- Fibre Channel
|
||||
hippiInterface(57), -- HIPPI interfaces
|
||||
frameRelayInterconnect(58), -- Obsolete use either
|
||||
-- frameRelay(32) or
|
||||
-- frameRelayService(44).
|
||||
aflane8023(59), -- ATM Emulated LAN for 802.3
|
||||
aflane8025(60), -- ATM Emulated LAN for 802.5
|
||||
cctEmul(61), -- ATM Emulated circuit
|
||||
fastEther(62), -- Obsoleted via RFC3635
|
||||
-- ethernetCsmacd (6) should be used instead
|
||||
isdn(63), -- ISDN and X.25
|
||||
v11(64), -- CCITT V.11/X.21
|
||||
v36(65), -- CCITT V.36
|
||||
g703at64k(66), -- CCITT G703 at 64Kbps
|
||||
g703at2mb(67), -- Obsolete see DS1-MIB
|
||||
qllc(68), -- SNA QLLC
|
||||
fastEtherFX(69), -- Obsoleted via RFC3635
|
||||
-- ethernetCsmacd (6) should be used instead
|
||||
channel(70), -- channel
|
||||
ieee80211(71), -- radio spread spectrum
|
||||
ibm370parChan(72), -- IBM System 360/370 OEMI Channel
|
||||
escon(73), -- IBM Enterprise Systems Connection
|
||||
dlsw(74), -- Data Link Switching
|
||||
isdns(75), -- ISDN S/T interface
|
||||
isdnu(76), -- ISDN U interface
|
||||
lapd(77), -- Link Access Protocol D
|
||||
ipSwitch(78), -- IP Switching Objects
|
||||
rsrb(79), -- Remote Source Route Bridging
|
||||
atmLogical(80), -- ATM Logical Port
|
||||
ds0(81), -- Digital Signal Level 0
|
||||
ds0Bundle(82), -- group of ds0s on the same ds1
|
||||
bsc(83), -- Bisynchronous Protocol
|
||||
async(84), -- Asynchronous Protocol
|
||||
cnr(85), -- Combat Net Radio
|
||||
iso88025Dtr(86), -- ISO 802.5r DTR
|
||||
eplrs(87), -- Ext Pos Loc Report Sys
|
||||
arap(88), -- Appletalk Remote Access Protocol
|
||||
propCnls(89), -- Proprietary Connectionless Protocol
|
||||
hostPad(90), -- CCITT-ITU X.29 PAD Protocol
|
||||
termPad(91), -- CCITT-ITU X.3 PAD Facility
|
||||
frameRelayMPI(92), -- Multiproto Interconnect over FR
|
||||
x213(93), -- CCITT-ITU X213
|
||||
adsl(94), -- Asymmetric Digital Subscriber Loop
|
||||
radsl(95), -- Rate-Adapt. Digital Subscriber Loop
|
||||
sdsl(96), -- Symmetric Digital Subscriber Loop
|
||||
vdsl(97), -- Very H-Speed Digital Subscrib. Loop
|
||||
iso88025CRFPInt(98), -- ISO 802.5 CRFP
|
||||
myrinet(99), -- Myricom Myrinet
|
||||
voiceEM(100), -- voice recEive and transMit
|
||||
voiceFXO(101), -- voice Foreign Exchange Office
|
||||
voiceFXS(102), -- voice Foreign Exchange Station
|
||||
voiceEncap(103), -- voice encapsulation
|
||||
voiceOverIp(104), -- voice over IP encapsulation
|
||||
atmDxi(105), -- ATM DXI
|
||||
atmFuni(106), -- ATM FUNI
|
||||
atmIma (107), -- ATM IMA
|
||||
pppMultilinkBundle(108), -- PPP Multilink Bundle
|
||||
ipOverCdlc (109), -- IBM ipOverCdlc
|
||||
ipOverClaw (110), -- IBM Common Link Access to Workstn
|
||||
stackToStack (111), -- IBM stackToStack
|
||||
virtualIpAddress (112), -- IBM VIPA
|
||||
mpc (113), -- IBM multi-protocol channel support
|
||||
ipOverAtm (114), -- IBM ipOverAtm
|
||||
iso88025Fiber (115), -- ISO 802.5j Fiber Token Ring
|
||||
tdlc (116), -- IBM twinaxial data link control
|
||||
gigabitEthernet (117), -- Obsoleted via RFC3635
|
||||
-- ethernetCsmacd (6) should be used instead
|
||||
hdlc (118), -- HDLC
|
||||
lapf (119), -- LAP F
|
||||
v37 (120), -- V.37
|
||||
x25mlp (121), -- Multi-Link Protocol
|
||||
x25huntGroup (122), -- X25 Hunt Group
|
||||
trasnpHdlc (123), -- Transp HDLC
|
||||
interleave (124), -- Interleave channel
|
||||
fast (125), -- Fast channel
|
||||
ip (126), -- IP (for APPN HPR in IP networks)
|
||||
docsCableMaclayer (127), -- CATV Mac Layer
|
||||
docsCableDownstream (128), -- CATV Downstream interface
|
||||
docsCableUpstream (129), -- CATV Upstream interface
|
||||
a12MppSwitch (130), -- Avalon Parallel Processor
|
||||
tunnel (131), -- Encapsulation interface
|
||||
coffee (132), -- coffee pot
|
||||
ces (133), -- Circuit Emulation Service
|
||||
atmSubInterface (134), -- ATM Sub Interface
|
||||
l2vlan (135), -- Layer 2 Virtual LAN using 802.1Q
|
||||
l3ipvlan (136), -- Layer 3 Virtual LAN using IP
|
||||
l3ipxvlan (137), -- Layer 3 Virtual LAN using IPX
|
||||
digitalPowerline (138), -- IP over Power Lines
|
||||
mediaMailOverIp (139), -- Multimedia Mail over IP
|
||||
dtm (140), -- Dynamic syncronous Transfer Mode
|
||||
dcn (141), -- Data Communications Network
|
||||
ipForward (142), -- IP Forwarding Interface
|
||||
msdsl (143), -- Multi-rate Symmetric DSL
|
||||
ieee1394 (144), -- IEEE1394 High Performance Serial Bus
|
||||
if-gsn (145), -- HIPPI-6400
|
||||
dvbRccMacLayer (146), -- DVB-RCC MAC Layer
|
||||
dvbRccDownstream (147), -- DVB-RCC Downstream Channel
|
||||
dvbRccUpstream (148), -- DVB-RCC Upstream Channel
|
||||
atmVirtual (149), -- ATM Virtual Interface
|
||||
mplsTunnel (150), -- MPLS Tunnel Virtual Interface
|
||||
srp (151), -- Spatial Reuse Protocol
|
||||
voiceOverAtm (152), -- Voice Over ATM
|
||||
voiceOverFrameRelay (153), -- Voice Over Frame Relay
|
||||
idsl (154), -- Digital Subscriber Loop over ISDN
|
||||
compositeLink (155), -- Avici Composite Link Interface
|
||||
ss7SigLink (156), -- SS7 Signaling Link
|
||||
propWirelessP2P (157), -- Prop. P2P wireless interface
|
||||
frForward (158), -- Frame Forward Interface
|
||||
rfc1483 (159), -- Multiprotocol over ATM AAL5
|
||||
usb (160), -- USB Interface
|
||||
ieee8023adLag (161), -- IEEE 802.3ad Link Aggregate
|
||||
bgppolicyaccounting (162), -- BGP Policy Accounting
|
||||
frf16MfrBundle (163), -- FRF .16 Multilink Frame Relay
|
||||
h323Gatekeeper (164), -- H323 Gatekeeper
|
||||
h323Proxy (165), -- H323 Voice and Video Proxy
|
||||
mpls (166), -- MPLS
|
||||
mfSigLink (167), -- Multi-frequency signaling link
|
||||
hdsl2 (168), -- High Bit-Rate DSL - 2nd generation
|
||||
shdsl (169), -- Multirate HDSL2
|
||||
ds1FDL (170), -- Facility Data Link 4Kbps on a DS1
|
||||
pos (171), -- Packet over SONET/SDH Interface
|
||||
dvbAsiIn (172), -- DVB-ASI Input
|
||||
dvbAsiOut (173), -- DVB-ASI Output
|
||||
plc (174), -- Power Line Communtications
|
||||
nfas (175), -- Non Facility Associated Signaling
|
||||
tr008 (176), -- TR008
|
||||
gr303RDT (177), -- Remote Digital Terminal
|
||||
gr303IDT (178), -- Integrated Digital Terminal
|
||||
isup (179), -- ISUP
|
||||
propDocsWirelessMaclayer (180), -- Cisco proprietary Maclayer
|
||||
propDocsWirelessDownstream (181), -- Cisco proprietary Downstream
|
||||
propDocsWirelessUpstream (182), -- Cisco proprietary Upstream
|
||||
hiperlan2 (183), -- HIPERLAN Type 2 Radio Interface
|
||||
propBWAp2Mp (184), -- PropBroadbandWirelessAccesspt2multipt
|
||||
-- use of this iftype for IEEE 802.16 WMAN
|
||||
-- interfaces as per IEEE Std 802.16f is
|
||||
-- deprecated and ifType 237 should be used instead.
|
||||
sonetOverheadChannel (185), -- SONET Overhead Channel
|
||||
digitalWrapperOverheadChannel (186), -- Digital Wrapper
|
||||
aal2 (187), -- ATM adaptation layer 2
|
||||
radioMAC (188), -- MAC layer over radio links
|
||||
atmRadio (189), -- ATM over radio links
|
||||
imt (190), -- Inter Machine Trunks
|
||||
mvl (191), -- Multiple Virtual Lines DSL
|
||||
reachDSL (192), -- Long Reach DSL
|
||||
frDlciEndPt (193), -- Frame Relay DLCI End Point
|
||||
atmVciEndPt (194), -- ATM VCI End Point
|
||||
opticalChannel (195), -- Optical Channel
|
||||
opticalTransport (196), -- Optical Transport
|
||||
propAtm (197), -- Proprietary ATM
|
||||
voiceOverCable (198), -- Voice Over Cable Interface
|
||||
infiniband (199), -- Infiniband
|
||||
teLink (200), -- TE Link
|
||||
q2931 (201), -- Q.2931
|
||||
virtualTg (202), -- Virtual Trunk Group
|
||||
sipTg (203), -- SIP Trunk Group
|
||||
sipSig (204), -- SIP Signaling
|
||||
docsCableUpstreamChannel (205), -- CATV Upstream Channel
|
||||
econet (206), -- Acorn Econet
|
||||
pon155 (207), -- FSAN 155Mb Symetrical PON interface
|
||||
pon622 (208), -- FSAN622Mb Symetrical PON interface
|
||||
bridge (209), -- Transparent bridge interface
|
||||
linegroup (210), -- Interface common to multiple lines
|
||||
voiceEMFGD (211), -- voice E&M Feature Group D
|
||||
voiceFGDEANA (212), -- voice FGD Exchange Access North American
|
||||
voiceDID (213), -- voice Direct Inward Dialing
|
||||
mpegTransport (214), -- MPEG transport interface
|
||||
sixToFour (215), -- 6to4 interface (DEPRECATED)
|
||||
gtp (216), -- GTP (GPRS Tunneling Protocol)
|
||||
pdnEtherLoop1 (217), -- Paradyne EtherLoop 1
|
||||
pdnEtherLoop2 (218), -- Paradyne EtherLoop 2
|
||||
opticalChannelGroup (219), -- Optical Channel Group
|
||||
homepna (220), -- HomePNA ITU-T G.989
|
||||
gfp (221), -- Generic Framing Procedure (GFP)
|
||||
ciscoISLvlan (222), -- Layer 2 Virtual LAN using Cisco ISL
|
||||
actelisMetaLOOP (223), -- Acteleis proprietary MetaLOOP High Speed Link
|
||||
fcipLink (224), -- FCIP Link
|
||||
rpr (225), -- Resilient Packet Ring Interface Type
|
||||
qam (226), -- RF Qam Interface
|
||||
lmp (227), -- Link Management Protocol
|
||||
cblVectaStar (228), -- Cambridge Broadband Networks Limited VectaStar
|
||||
docsCableMCmtsDownstream (229), -- CATV Modular CMTS Downstream Interface
|
||||
adsl2 (230), -- Asymmetric Digital Subscriber Loop Version 2
|
||||
-- (DEPRECATED/OBSOLETED - please use adsl2plus 238 instead)
|
||||
macSecControlledIF (231), -- MACSecControlled
|
||||
macSecUncontrolledIF (232), -- MACSecUncontrolled
|
||||
aviciOpticalEther (233), -- Avici Optical Ethernet Aggregate
|
||||
atmbond (234), -- atmbond
|
||||
voiceFGDOS (235), -- voice FGD Operator Services
|
||||
mocaVersion1 (236), -- MultiMedia over Coax Alliance (MoCA) Interface
|
||||
-- as documented in information provided privately to IANA
|
||||
ieee80216WMAN (237), -- IEEE 802.16 WMAN interface
|
||||
adsl2plus (238), -- Asymmetric Digital Subscriber Loop Version 2,
|
||||
-- Version 2 Plus and all variants
|
||||
dvbRcsMacLayer (239), -- DVB-RCS MAC Layer
|
||||
dvbTdm (240), -- DVB Satellite TDM
|
||||
dvbRcsTdma (241), -- DVB-RCS TDMA
|
||||
x86Laps (242), -- LAPS based on ITU-T X.86/Y.1323
|
||||
wwanPP (243), -- 3GPP WWAN
|
||||
wwanPP2 (244) -- 3GPP2 WWAN
|
||||
}
|
||||
|
||||
IANAtunnelType ::= TEXTUAL-CONVENTION
|
||||
STATUS current
|
||||
DESCRIPTION
|
||||
"The encapsulation method used by a tunnel. The value
|
||||
direct indicates that a packet is encapsulated
|
||||
directly within a normal IP header, with no
|
||||
intermediate header, and unicast to the remote tunnel
|
||||
endpoint (e.g., an RFC 2003 IP-in-IP tunnel, or an RFC
|
||||
1933 IPv6-in-IPv4 tunnel). The value minimal indicates
|
||||
that a Minimal Forwarding Header (RFC 2004) is
|
||||
inserted between the outer header and the payload
|
||||
packet. The value UDP indicates that the payload
|
||||
packet is encapsulated within a normal UDP packet
|
||||
(e.g., RFC 1234).
|
||||
|
||||
The values sixToFour, sixOverFour, and isatap
|
||||
indicates that an IPv6 packet is encapsulated directly
|
||||
within an IPv4 header, with no intermediate header,
|
||||
and unicast to the destination determined by the 6to4,
|
||||
6over4, or ISATAP protocol.
|
||||
|
||||
The remaining protocol-specific values indicate that a
|
||||
header of the protocol of that name is inserted
|
||||
between the outer header and the payload header.
|
||||
|
||||
The assignment policy for IANAtunnelType values is
|
||||
identical to the policy for assigning IANAifType
|
||||
values."
|
||||
SYNTAX INTEGER {
|
||||
other(1), -- none of the following
|
||||
direct(2), -- no intermediate header
|
||||
gre(3), -- GRE encapsulation
|
||||
minimal(4), -- Minimal encapsulation
|
||||
l2tp(5), -- L2TP encapsulation
|
||||
pptp(6), -- PPTP encapsulation
|
||||
l2f(7), -- L2F encapsulation
|
||||
udp(8), -- UDP encapsulation
|
||||
atmp(9), -- ATMP encapsulation
|
||||
msdp(10), -- MSDP encapsulation
|
||||
sixToFour(11), -- 6to4 encapsulation
|
||||
sixOverFour(12), -- 6over4 encapsulation
|
||||
isatap(13), -- ISATAP encapsulation
|
||||
teredo(14) -- Teredo encapsulation
|
||||
}
|
||||
|
||||
END
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user