Title: icmp_port

There is one icmp port for each interface. For the following inet.conf file:

eth0 DP8390 0 { default; };

there will be 2 icmp ports, one for the ethernet interface and one for the psip interface.

Note that the icmp layer does not have a concept of a file descriptor.

typedef struct icmp_port

int icp_flags;
int icp_state;
int icp_ipport;
int icp_ipfd;
acc_t *icp_head_queue;
acc_t *icp_tail_queue;
acc_t *icp_write_pack;
} icmp_port_t;
int icp_flags:

icp_flags will be of the following:

#define ICPF_EMPTY 0x0
#define ICPF_SUSPEND 0x1
#define ICPF_READ_IP 0x2
#define ICPF_READ_SP 0x4
#define ICPF_WRITE_IP 0x8
#define ICPF_WRITE_SP 0x10

The flags above are self-explanatory.

int icp_state:

icp_state will be one of the following:

#define ICPS_BEGIN 0
#define ICPS_IPOPT 1
#define ICPS_MAIN 2
#define ICPS_ERROR 3

After the network service has been initialized and configured, the state of the icmp port is ICPS_MAIN and does not leave this state unless there is an error or the icmp port is reconfigured.

int icp_ipport:

The icmp port's associated ip port.
int icp_ipfd: The icmp port's associated ip file descriptor.

acc_t *icp_head_queue, *icp_tail_queue, *icp_write_pack:

icp_head_queue/icp_tail_queue is the head and tail of the write queue for the icmp port. Immediately before ip_write() is called, the head of the write queue is placed in icp_write_pack field and then the ip code attempts to send out the icmp packet in this field.