PGEN-Netutil

This component has many functions about network utility.

 

Function Usages

Name

pgen_send_to_netif
pgen_recv_from_netif    —   send/recv to network interfaces

pgen_getipbydev
pgen_getmaskbydev
pgen_getmacbydev
pgen_port2service    —   functions that get network informations.

 

Synopsis

 

Description

pgen_send_to_netif() sends binary to network interface with socket descriptor.
pgen_recv_from_netif() recvs binary from network interface with socket descriptor.

sock, 1st argument is socket descriptor that opened by socket().
buf, 2nd argument is pointer of buffer.
len, 3rd argment is buffer length.

pgen_getipbydev() gets IP address from network interface.
pgen_getmaskbydev() gets NET-MASK from network interface.
pgen_getmacbydev() gets MAC address from network interface.

device, 1st argument is name of device to getting address.
ip or mac, 2nd argument are string buffer.

pgen_port2service() gets service name from port number.

port, 1st argument is port number to getting service.
protocol, 2nd argument set protocol, “TCP” or “UDP”, char* string.
buf, 3rd argument is string buffer.

 

Return Value

pgen_send_to_netif(),  pgen_recv_from_netif()  return sended/recved length.

pgen_getipbydev() ,pgen_getmaskbydev() ,pgen_getmacbydev() return positive integer, if these successe to get address. Else, return negative integer.

pgen_port2service() return pointer of service-name’s string, if it successe to exchange port number to service. Else, it returns NULL.

Errors

Comments are closed.