# ip_header

Creates a IP Header BETA

Author | Matthew Schinkel - borntechi.com, copyright © 2011, all rights reserved.
Adapted-by |
Compiler | >=2.4n

Description

    this library creates a IP header

Sources

    http://www.faqs.org/rfcs/rfc791.html
    http://www.tekelec.com/ss7/protocols/ip2.asp
    http://www.networksorcery.com/enp/protocol/ip.htm

Dependencies

No dependency found

## Summary

### Global variables/contants

- `const IP_HEADER_SOURCE_IP_1 = 14`
- `const IP_HEADER_SOURCE_IP_0 = 15`
- `const IP_HEADER_IDENTIFICATION = 4`
- `const IP_HEADER_SERVICE = 1`
- `const IP_HEADER_DESTINATION_IP_0 = 19`
- `const IP_HEADER_DESTINATION_IP_2 = 17`
- `var byte ip_header_size = 20`
- `const byte ICMP = 1`
- `const IP_HEADER_CHECKSUM = 10`
- `const IP_HEADER_PROTOCOL = 9`
- `const IP_HEADER_TOTAL_LENGTH = 2`
- `const IP_HEADER_SOURCE_IP_2 = 13`
- `const IP_HEADER_DESTINATION_IP_1 = 18`
- `const IP_HEADER_VERSION_LENGTH = 0`
- `const IP_HEADER_FLAGS_OFFSET = 6`
- `const byte TCP = 6`
- `const IP_HEADER_DESTINATION_IP_3 = 16`
- `const IP_HEADER_SOURCE_IP_3 = 12`
- `const IP_HEADER_TTL = 8`
- `const byte UDP = 17`

### Procedures

- `ip_header_set_source_ip()`
- `ip_header_create(byte in protocol_select, word in data_length)`
- `ip_header_read_packet()`

### Functions

- `ip_header_verify() return byte`

## API details

### Global variables/contants

- `const IP_HEADER_SOURCE_IP_1 = 14`

  No documentation found

- `const IP_HEADER_SOURCE_IP_0 = 15`

  No documentation found

- `const IP_HEADER_IDENTIFICATION = 4`

      word

- `const IP_HEADER_SERVICE = 1`

      byte

- `const IP_HEADER_DESTINATION_IP_0 = 19`

  No documentation found

- `const IP_HEADER_DESTINATION_IP_2 = 17`

  No documentation found

- `var byte ip_header_size = 20`

  No documentation found

- `const byte ICMP = 1`

      protocol types, for "IP_HEADER_PROTOCOL"

- `const IP_HEADER_CHECKSUM = 10`

  No documentation found

- `const IP_HEADER_PROTOCOL = 9`

      byte

- `const IP_HEADER_TOTAL_LENGTH = 2`

      word

- `const IP_HEADER_SOURCE_IP_2 = 13`

  No documentation found

- `const IP_HEADER_DESTINATION_IP_1 = 18`

  No documentation found

- `const IP_HEADER_VERSION_LENGTH = 0`

      byte

- `const IP_HEADER_FLAGS_OFFSET = 6`

      word

- `const byte TCP = 6`

      TCP protocol number for ip header

- `const IP_HEADER_DESTINATION_IP_3 = 16`

  No documentation found

- `const IP_HEADER_SOURCE_IP_3 = 12`

  No documentation found

- `const IP_HEADER_TTL = 8`

      byte

- `const byte UDP = 17`

      UDP protocol number for ip header

### Procedures

- `ip_header_set_source_ip()`

      Set source ip address in ip header

- `ip_header_create(byte in protocol_select, word in data_length)`

      Send a ip header

- `ip_header_read_packet()`

  No documentation found

### Functions

- `ip_header_verify() return byte`

      Verify incomming ip header. Checks that ip header ip address is
      the same as our local ip address. checks ip header checksum

## Related samples

Here are the list of samples which use this library:

18f4620 | 18f4620_network_udp_server.jal
18f4620 | 18f4620_network_slip_isr_ping_udp.jal
18f4620 | 18f4620_network_webserver_enc28j60.jal
18f4620 | 18f4620_network_udp_client.jal
18f4620 | 18f4620_network_all_in_one.jal
18f4620 | 18f4620_network_tcp_client.jal
18f4620 | 18f4620_network_tcp_server.jal
18f4620 | 18f4620_network_ping.jal