|
miniOS
x86_64 hobby kernel with SMP, VFS, and POSIX process model
|
ping — sends 4 ICMP echo requests via SOCK_RAW, measures RTT with clock_gettime(CLOCK_MONOTONIC), and prints per-packet timing + summary. Per D-08 through D-12. More...
#include <string.h>#include <sys/socket.h>#include <netinet/in.h>#include <unistd.h>#include <time.h>#include <stdint.h>
Macros | |
| #define | SOCK_RAW 3 |
| #define | IPPROTO_ICMP 1 |
| #define | PING_COUNT 4 |
| #define | ICMP_ECHO_ID 0x1234 |
Functions | |
| static void | rprint (const char *s) |
| static void | rprint_int (long val) |
| Convert a signed integer to decimal string and write via rprint. | |
| static unsigned short | icmp_checksum (const void *data, int len) |
| Compute ones-complement Internet checksum. Verbatim copy from user/rawtest/main.c. | |
| static uint32_t | parse_ipv4 (const char *s) |
| Parse "A.B.C.D" into the packed IPv4 layout used by miniOS raw sockets. | |
| int | main (int argc, char *argv[]) |
ping — sends 4 ICMP echo requests via SOCK_RAW, measures RTT with clock_gettime(CLOCK_MONOTONIC), and prints per-packet timing + summary. Per D-08 through D-12.
| #define ICMP_ECHO_ID 0x1234 |
| #define IPPROTO_ICMP 1 |
| #define PING_COUNT 4 |
| #define SOCK_RAW 3 |
|
static |
Compute ones-complement Internet checksum. Verbatim copy from user/rawtest/main.c.

| int main | ( | int | argc, |
| char * | argv[] ) |

|
static |
Parse "A.B.C.D" into the packed IPv4 layout used by miniOS raw sockets.
Per T-44-02-02: rejects malformed input by returning 0 when any octet exceeds 255 or fewer than 4 octets are present.
|
static |

|
static |
Convert a signed integer to decimal string and write via rprint.

