network-programming-examples
所属分类:TCP/IP协议栈
开发工具:C
文件大小:0KB
下载次数:0
上传日期:2016-01-24 14:33:03
上 传 者:
sh-1993
说明: C.中的IPv4和IPv6套接字编程。,
(IPv4 and IPv6 socket programming in C.,)
文件列表:
LICENSE (18047, 2016-01-24)
Makefile (609, 2016-01-24)
src/ (0, 2016-01-24)
src/bind_dev.c (2630, 2016-01-24)
src/get_ifs_ips.c (2171, 2016-01-24)
src/get_mtu.c (1879, 2016-01-24)
src/getaddrinfo.c (1932, 2016-01-24)
src/icmpv4_echo__icmp_socket.c (3368, 2016-01-24)
src/icmpv4_echo__icmp_socket_ancillary.c (4192, 2016-01-24)
src/icmpv4_echo__raw_socket.c (4234, 2016-01-24)
src/icmpv6_echo__icmpv6_socket.c (2952, 2016-01-24)
src/icmpv6_echo__icmpv6_socket_ancillary.c (3959, 2016-01-24)
src/icmpv6_na__icmpv6_socket_ancillary.c (6558, 2016-01-24)
src/icmpv6_ns__icmpv6_socket_ancillary.c (5897, 2016-01-24)
src/icmpv6_ra__icmpv6_socket_ancillary.c (5979, 2016-01-24)
src/icmpv6_rs__icmpv6_socket_ancillary.c (5579, 2016-01-24)
src/iovec.c (1298, 2016-01-24)
src/tcp4_syn__eth_socket.c (11248, 2016-01-24)
## IPv4 and IPv6 raw sockets programming
#### Introduction :
Low level socket programming in C.
--
#### ARP
--
#### IPv4
##### # ICMPv4:
- When create a ICMP socket `socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)`, the kernel will fill the Ethernet and IP header automatically.
- Using ancillary data to specify the option content for only a single datagram.
- More details on using ancillary data, please refer to `Linux Socket Programming by Example - Chapter 17`.
| Code | Descriptions |
| --- | --- |
| [icmpv4_echo__icmp_socket.c](https://github.com/Lancher/network-programming-examples/blob/master/src/icmpv4_echo__icmp_socket.c) | Send echo request (with TTL)). |
| [icmpv4_echo__icmp_socket_ancillary.c](https://github.com/Lancher/network-programming-examples/blob/master/src/icmpv4_echo__icmp_socket_ancillary.c) | Send echo request using ancillary data (with TTL)). |
| [icmpv4_echo__raw_socket.c](https://github.com/Lancher/network-programming-examples/blob/master/src/icmpv4_echo__raw_socket.c) | Create a Raw socket(IP_HDRINCL) to send echo request (with TTL). |
--
#### IPv6
##### # IPv6:
- Fragmentation.
- Hop-by-Hop Extension Header.
##### # ICMPv6:
- IPv6 sockets api [RFC3493](https://github.com/Lancher/network-programming-examples/blob/master/http://www.ietf.org/rfc/rfc3493.txt) and [RFC3542](https://github.com/Lancher/network-programming-examples/blob/master/http://www.ietf.org/rfc/rfc3542.txt).
- When create a ICMPv6 socket `socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)`, the kernel will fill the Ethernet, IP header and ICMPv6 header chuckseum automatically.
- All the fields in IPv6 header and all the extension headers can be set by `ancillary data` or `setsockopt()`.
- There is No option similar to the `IPv4 IP_HDRINCL` socket option.
- Using ancillary data to specify the option content for a single datagram.
| Code | Descriptions |
| --- | --- |
| [icmpv6_echo__icmpv6_socket.c](https://github.com/Lancher/network-programming-examples/blob/master/src/icmpv6_echo__icmpv6_socket.c) | Send echo request (with hoplimit). |
| [icmpv6_echo__icmpv6_socket_ancillary.c](https://github.com/Lancher/network-programming-examples/blob/master/src/icmpv6_echo__icmpv6_socket_ancillary.c) | Send echo request using ancillary data (with hoplimit). |
- Neighbor Discovery [RFC4861](https://github.com/Lancher/network-programming-examples/blob/master/https://tools.ietf.org/html/rfc4861).
- IPv6 Neighbor Discovery (using multicast address, IPv6 do NOT have broadcast address).
- Neighbor Solicitation/Advertisement and Router Solicitation/Advertisement
| Code | Descriptions |
| --- | --- |
| [icmpv6_ns__icmpv6_socket_ancillary.c](https://github.com/Lancher/network-programming-examples/blob/master/src/icmpv6_ns__icmpv6_socket_ancillary.c) | Send neighbor solicitation request (with hoplimit). |
| [icmpv6_na__icmpv6_socket_ancillary.c](https://github.com/Lancher/network-programming-examples/blob/master/src/icmpv6_na__icmpv6_socket_ancillary.c) | Send neighbor advertisement request (with hoplimit). |
| [icmpv6_rs__icmpv6_socket_ancillary.c](https://github.com/Lancher/network-programming-examples/blob/master/src/icmpv6_rs__icmpv6_socket_ancillary.c) | Send router solicitation request (with hoplimit). |
| [icmpv6_ra__icmpv6_socket_ancillary.c](https://github.com/Lancher/network-programming-examples/blob/master/src/icmpv6_ra__icmpv6_socket_ancillary.c) | Send router advertisement request (with hoplimit). |
##### # Tunneling IPv6 over IPv4:
- [RFC4213](https://github.com/Lancher/network-programming-examples/blob/master/http://www.ietf.org/rfc/rfc4213.txt).
--
#### TCP4
| Code | Descriptions |
| --- | --- |
| [tcp4_syn__eth_socket.c](https://github.com/Lancher/network-programming-examples/blob/master/src/tcp4_syn__eth_socket.c) | Send TCP SYN packet (construct from ethernet layer). |
--
#### Miscellaneous
| Code | Descriptions |
| --- | --- |
| [getaddrinfo.c](https://github.com/Lancher/network-programming-examples/blob/master/src/getaddrinfo.c) | Use `getaddrinfo()` to identify an Internet hostname. |
| [bind_dev.c](https://github.com/Lancher/network-programming-examples/blob/master/src/bind_dev.c) | Bind a socket to a network interface(eth0, eth1 ...). |
| [iovec.c](https://github.com/Lancher/network-programming-examples/blob/master/src/iovec.c) | How iovec work in ancillary data. |
| [get_ifs_ips.c](https://github.com/Lancher/network-programming-examples/blob/master/src/get_ifs_ips.c) | List all the interfaces and ip address. |
| [get_mtu.c](https://github.com/Lancher/network-programming-examples/blob/master/src/get_mtu.c) | Retrieve MTU of a interface. |
--
近期下载者:
相关文件:
收藏者: