Maxcompiler Networking Cheat Sheet

ADVERTISEMENT

MaxCompiler Networking Cheat Sheet
Version 2014.1
IP Address Configuration
UDP
Framed Streams
where “fd” is an input or output FrameData instance, “id” and ty
are as above, and also:
for transferring packets statelessly
for transferring framed data from the DFE to the CPU
initialization in CPU code for any network application
min
minimum number of elements
Network Manager Interface
Network Manager Interface
To set the local IP address and netmask:
max
maximum number of elements
To create a pair U of UDP streams, a UDP stream x receiving
To declare a stream S in the Manager:
gr
number of elements per transfer (optional)
max ip config
(dh
,
cn
,
ip
, nm)
and a UDP stream y transmitting to the network:
sz
DFEVar where the number of elements is stored
DFELink S = addFramedStreamToCPU (st, ty, as, bs)
where
nm is the netmask, a pointer to type struct in addr as
UDPStream U = addUDPStream (st, co, cm, sm)
Creating Framed Streams
with
declared in #include netinet/in.h .
DFELink x = U.getReceiveStream ()
ty
a FramedBusType
To create a framed input fdi and a framed output fdo:
DFELink y = U.getTransmitStream ()
TCP
as
the alignment size (optional integer parameter)
FrameData F fdi = io.frameInput(st,
new
F (
), bt)
with sm either DropBadFrames, FlagOnEOF or Disabled
bs
the buffer size (optional integer parameter)
FrameData F fdo =
new
FrameData F (this,
new
F (
))
for working with persistent and reliable connections
Standard Manager Interface
CPU Interface
where class F extends FrameFormat, and bt is a bus type:
Network Manager Interface
Connect UDP streams named in the Kernel to the network:
initialization/reclamation
TCPType
To create a pair T of TCP streams, a TCP stream x receiving,
mg
.setIO(
UDPOneToOneRXType
and a TCP stream y transmitting to the network:
To create a handle fh of type max framed stream t , and to free
Manager.link
(st
, Manager.UDP (co, cm)),
UDPOneToOneTXType
the handle:
Manager.link
(st
, Manager.UDP (co, cm)))
TCPStream T = addTCPStream (st, co)
UDPOnetoManyRXType
fh =
max framed stream setup
(dh, st, bu, bs)
DFELink x = T .getReceiveStream ()
UDPOneToManyTXType
CPU Interface
max framed stream release
(fh)
DFELink y = T .getTransmitStream ()
with
To create a UDP socket us, to find its socket number sn, and to
Using Framed Streams
Standard Manager Interface
bu
a pointer to a buffer storage area
close the socket:
Methods on an input FrameData fdi:
bs
the size of the buffer in bytes
us
max udp create socket
(dh, st)
Connect TCP streams named in the Kernel to the network:
fdi[“id”]
value of frame field “id”
usage
sn
max udp get socket number
(us)
mg
.setIO(
fdi.isStart()
implies data is available
max udp close
(us)
Transfer data by alternately requesting and acknowledging
Manager.link
(st
, Manager.TCP (co)),
fdi.linkfield[“id”]
readable field from the bus
To let a UDP socket receive data:
receipt of a number of frames.
Manager.link
(st
, Manager.TCP (co)))
Methods on an output FrameData fdo:
fr =
max framed stream read
(fh, rf , fp, fs)
max udp bind (us, pn)
CPU Interface
fdo[“id”]
x
assign a frame field
max framed stream discard
(fh, af )
To let a OneToOne mode UDP socket send data:
fdo.linkfield[“id”]
y
writable field from the bus
To create a TCP socket ts, to find its socket number sn, and to
with
io.frameOutput (st, fdo, ev )
transmit
close the socket:
max udp connect (us, ip, pn)
rf
the requested number of frames
where ev is a boolean indicating frames are initialized, typically
Ethernet
ts
max tcp create socket
(dh, st)
fp
a pointer to an array of pointers to frame buffers
fdi.isStart(), if the output derives from an input fdi
sn
max tcp get socket number
(ts)
for handling network traffic on a low level
fs
a pointer to an array of the frame buffer sizes
max tcp close
(ts)
fr
the number of frames actually read
Network Manager Interface
Common Parameters
af
the number of frames acknowledged (
fr )
To connect to a remote server:
To create a pair E of Ethernet streams, an Ethernet stream x
Framed Kernels
max tcp connect (ts, ip, pn)
dh
a device handle returned by max open device
receiving and an Ethernet stream y transmitting to the network:
st
a stream name as a character string
To accept connections from remote clients:
for transparent marshalling and tunneling of framed data
EthernetStream E = addEthernetStream (st, co, em)
ts
a TCP socket of type max tcp socket t*
max tcp listen
(ts
, pn)
DFELink x = E.getReceiveStream ()
Creating Framed Stream Formats
ip
an IP address of type struct in addr*
DFELink y = E.getTransmitStream ()
To monitor connections from remote clients by waiting for a
us
a UDP socket of type max udp socket t*
Define a class extending FrameFormat.
In the constructor
specified connection state:
with em either DropBadFrames or FlagOnEOF
cm
a connection mode, OneToOne or OneToMany
method, call one of:
pn
a local or remote port number of type uint 16
rs = max tcp await state
(ts
, cs , to)
Standard Manager Interface
super
(ByteOrder.LITTLE ENDIAN)
sn
a socket number from 0 to 63 for TCP
with
Connect Ethernet streams named in the Kernel to the network:
super
(ByteOrder.BIG ENDIAN)
or from 0 to 15 for UDP
cs
the awaited connection state
mg
.setIO(
mg
a standard Manager object
Define any number of fixed sized fields:
to
the timeout value (of type struct timeval*)
Manager.link
(st
, Manager.ETHERNET (co)),
co
Max3NetworkConnection.CH2 SFP1
fr = addField (“id” , ty )
rs
zero iff the state is reached before timeout
Manager.link
(st
, Manager.ETHERNET (co)))
or Max3NetworkConnection.CH2 SFP2
with
where connection states are
cn
MAX NET CONNECTION CH2 SFP1
CPU Interface
“id”
the name of the field
or MAX NET CONNECTION CH2 SFP2
MAX TCP STATE CLOSED
To read the default MAC addresses from hardware:
ty
the type of the field as any Kernel type
MAX TCP STATE LISTEN
max eth get default mac address (dh, cn, mac )
Define any number of variable sized fields:
MAX TCP STATE ESTABLISHED
MAX TCP STATE CLOSE WAIT
where mac is a pointer to a struct ether addr as defined in the
addVariableLengthField (“id” , ty , min , max [, gr ])
MAX TCP STATE CLOSED DATA PENDING
fd .setSizeForVariableField (“id” , sz )
standard #include net/ethernet.h

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go