The ping command in c
##allowed functions :
- getpid : returns the process ID of the calling process.
- getuid : returns the real user ID of the calling process.
- getaddrinfo : convert domain names, hostnames, and IP addresses between human-readable text representations and structured binary formats for the operating system's networking API.
- gettimeofday : can get and set the time as well as a timezone.
- inet_ntop : convert IPv4 and IPv6 addresses from binary to text form.
- inet_pton : convert IPv4 and IPv6 addresses from text to binary form
- exit
- signal : sets the disposition of the signal signum to handler, which is either SIG_IGN, SIG_DFL, or the address of a programmer-defined function (a "signal handler")
- alarm : arranges for a SIGALRM signal to be delivered to the calling process in seconds seconds.
- setsockopt : manipulate options for the socket referred to by the file descriptor sockfd. Options may exist at multiple protocol levels; they are always present at the uppermost socket level.
- recvmsg : receive a message from a socket
- sendto : send a message on a socket
- socket : create an endpoint for communication
##References
http://sotodayithought.blogspot.fr/2010/03/simple-ping-implementation-in-c.html
http://www.binarytides.com/icmp-ping-flood-code-sockets-c-linux/
https://www.cs.utah.edu/~swalton/listings/sockets/programs/part4/chap18/myping.c