Adm api files – ProSoft Technology MVI69-ADMNET User Manual
Page 60
Understanding the MVI-ADMNET API
MVI-ADMNET ♦ 'C' Programmable
Developer's Guide
'C' Programmable Application Development Module with Ethernet
Page 60 of 122
ProSoft Technology, Inc.
February 20, 2013
4.4
ADM API Files
The following table lists the supplied API file names. These files should be copied
to a convenient directory on the computer where the application is to be
developed. These files need not be present on the module when executing the
application.
File Name
Description
ADMNETAPI.H
Include file
ADMNETAPI.LIB
Library (16-bit OMF format)
4.4.1 ADM Interface Structure
The ADMNET interface structure functions mainly as a protocol UDP and TCP
socket. Pointers to structures are used so that the API can access lower-level
Ethernet communication. The ADMNET API requires the interface structure and
the structures referenced by it. Refer to the example code section for examples
of the functions.
The interface structure is as follows:
typedef struct _tcp_socket {
struct _tcp_socket *next;
word ip_type; // always set to TCP_PROTO
char *err_msg;
char *usr_name;
void (*usr_yield)(void);
byte rigid;
byte stress;
word sock_mode; // a logical OR of bits
longword usertimer; // ip_timer_set, ip_timer_timeout
dataHandler_t dataHandler; // called with incoming data
eth_address hisethaddr; // ethernet address of peer
longword hisaddr; // internet address of peer
word hisport; // tcp ports for this connection
longword myaddr;
word myport;
word locflags;
int queuelen;
byte *queue;
int rdatalen; // must be signed
word maxrdatalen;
byte *rdata;
byte rddata[tcp_MaxBufSize+1]; // received data
longword safetysig;
word state; // connection state
longword acknum;
longword seqnum; // data ack'd and sequence num
long timeout; // timeout, in milliseconds
byte unhappy; // flag, indicates retransmitting
segt's
byte recent; // 1 if recently transmitted