The header file of the XILNET library is under the% EDK% / SW / LIB / SW_SERVICES / XILNET_V2_00_A / SRC / INCLUDE / folder, we often see the referenced header files in the file to write into a #include
In addition, analyze a bit domain that is most common in XILNET:
struct xilsock_socket {int type; int domain; int proto; // status of socket unsigned char listen: 1; unsigned char bound: 1; unsigned char accept: 1; unsigned char connect: 1; unsigned char free: 1; unsigned char closing : 1; unsigned char closed: 1; union {structure xilnet_tcp_conn * tcp_conn; struct xilnet_udp_conn * udp_conn;} conn;
There is also an array:
#define no_of_xilsocks (Max_TCP_CONNS MAX_UDP_CONNS) EXTERN STRUCT XILSOCK_SOCKET XILSOCK_SOCKETS [NO_OF_XILSOCKS];
(This array is declared for Extern, so it will be used in your own program)
There is also a structure that is often used:
Struct xilsock_buf {unsigned char * buf; int size;};
It is worth noting that there is a function not mentioned in EDK OS and Libraries Reference Guide, but in xilsock.h, it is declared in xilsock.h, and it is also common:
Extern Int Xilsock_listen (int, int);
Other common functions include:
extern int xilsock_init (void); extern void xilsock_rel_socket (int); extern int xilsock_socket (int, int, int); extern int xilsock_bind (int, struct sockaddr *, int); extern int xilsock_accept (int, struct sockaddr *, int * ); extern int xilsock_recv (int, unsigned char *, unsigned int); extern int xilsock_recvfrom (int, unsigned char *, unsigned int, struct sockaddr * from, unsigned int * fromlen); extern int xilsock_sendto (int, unsigned char *, Unsigned int, struct sockaddr * to, unsigned int toolen; extern int xilsock_send (int, unsigned char *, unsigned int); extern void xilsock_close (int);
// Ethernet functionsextern int xilnet_eth_recv_frame (unsigned char *, int); extern int xilnet_eth_send_frame (unsigned char *, int, unsigned char *, void *, unsigned short); extern void xilnet_eth_update_hw_tbl (unsigned char *, int); extern void xilnet_add_hw_tbl_entry ( unsigned char *, unsigned char *); extern int xilnet_eth_get_hw_addr (unsigned char *); extern void xilnet_eth_init_hw_addr_tbl (void); extern int xilnet_eth_find_old_entry (void); also with ARP functions, TCP / UDP / ICMP functions and other functions as are also declared as Extern, you can call directly.
Several common arrays of several extern types, variables:
/ * Buffers for sending and receiving packets * / extern unsigned char recvbuf []; extern unsigned char sendbuf []; extern unsigned char mb_ip_addr [IP_VERSION]; extern unsigned char mb_hw_addr [ETH_ADDR_LEN]; extern int xilsock_status_flag;