netatalk: macip.c File Reference

netatalk 4.5.1
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
macip.c File Reference
`#include <sys/types.h>`
`#include <sys/param.h>`
`#include <sys/socket.h>`
`#include <sys/time.h>`
`#include <sys/uio.h>`
`#include <netatalk/at.h>`
`#include <atalk/aep.h>`
`#include <atalk/ddp.h>`
`#include <atalk/atp.h>`
`#include <atalk/zip.h>`
`#include <signal.h>`
`#include <stdio.h>`
`#include <stdint.h>`
`#include <stdlib.h>`
`#include <unistd.h>`
`#include <string.h>`
`#include <netdb.h>`
`#include <errno.h>`
`#include <netinet/in_systm.h>`
`#include <netinet/in.h>`
`#include <netinet/ip.h>`
`#include <netinet/ip_icmp.h>`
`#include "atp_input.h"`
`#include "nbp_lkup_async.h"`
`#include "common.h"`
`#include "macip.h"`
`#include "util.h"`

## Data Structures
struct | macip_req_control
struct | macip_req_data
struct | macip_req
struct | ipent
struct | macip_data
struct | zones

## Macros
#define | DDPTYPE_MACIP (22)
#define | MACIP_ASSIGN (1)
#define | MACIP_SERVER (3)
#define | MACIP_PORT (72)
#define | MACIP_MAXMTU (586)
#define | MACIP_NODETYPE "IPADDRESS"
#define | MACIP_GATETYPE "IPGATEWAY"
#define | MACIP_ATPRETRIES (5)
#define | MACIP_ATPWAIT (5)
#define | MACIP_NBPRETRIES (5)
#define | MACIP_NBPWAIT (5)
#define | ARPTIMEOUT (30)
#define | ARPRETRIES (10)
#define | ASSIGN_FREE (0)
#define | ASSIGN_LEASED (1)
#define | ASSIGN_FIXED (2)
#define | IPADDR(e)
#define | MAXZONES 256

## Functions
static uint16_t | cksum (char *buffer, int len)
static void | icmp_echo (uint32_t src, uint32_t dst)
static long | now (void)
struct ipent * | get_ipent (uint32_t ip)
static uint32_t | lease_ip ()
static int | arp_lookup (struct sockaddr_at *sat, uint32_t ip)
static void | arp_set (uint32_t ip, struct sockaddr_at *sat)
static void | arp_input (struct sockaddr_at *sat, char *buffer, int len)
static void | ip_input (struct sockaddr_at *sat, char *buffer, int len)
void | macip_output (char *buffer, int len)
static void | config_input (ATP atp, struct sockaddr_at *faddr, char *packet, int len)
void | macip_input (void)
static int | init_ip (uint32_t net, uint32_t mask, uint32_t nameserver)
static void | add_zones (short n, char *buf)
static int | get_zones (void)
void | macip_idle (void)
int | macip_open (char *zone, uint32_t net, uint32_t mask, uint32_t ns, outputfunc_t o)
void | macip_close (void)

## Variables
static struct macip_data | gMacip
static struct zones | gZones
static outputfunc_t | gOutput

## Macro Definition Documentation

## ◆ ARPRETRIES

#define ARPRETRIES (10)

## ◆ ARPTIMEOUT

#define ARPTIMEOUT (30)

## ◆ ASSIGN_FIXED

#define ASSIGN_FIXED (2)

## ◆ ASSIGN_FREE

#define ASSIGN_FREE (0)

## ◆ ASSIGN_LEASED

#define ASSIGN_LEASED (1)

## ◆ DDPTYPE_MACIP

#define DDPTYPE_MACIP (22)

## ◆ IPADDR

#define IPADDR | ( |  | e | ) |

Value:
(e - gMacip.ipent + gMacip.net + 1)
gMacip
static struct macip_data gMacip
Definition macip.c:130

## ◆ MACIP_ASSIGN

#define MACIP_ASSIGN (1)

## ◆ MACIP_ATPRETRIES

#define MACIP_ATPRETRIES (5)

## ◆ MACIP_ATPWAIT

#define MACIP_ATPWAIT (5)

## ◆ MACIP_GATETYPE

#define MACIP_GATETYPE "IPGATEWAY"

## ◆ MACIP_MAXMTU

#define MACIP_MAXMTU (586)

## ◆ MACIP_NBPRETRIES

#define MACIP_NBPRETRIES (5)

## ◆ MACIP_NBPWAIT

#define MACIP_NBPWAIT (5)

## ◆ MACIP_NODETYPE

#define MACIP_NODETYPE "IPADDRESS"

## ◆ MACIP_PORT

#define MACIP_PORT (72)

## ◆ MACIP_SERVER

#define MACIP_SERVER (3)

## ◆ MAXZONES

#define MAXZONES 256

## Function Documentation

## ◆ add_zones()

void add_zones | ( | short | n,
|  | char * | buf )
| static

## ◆ arp_input()

void arp_input | ( | struct sockaddr_at * | sat,
|  | char * | buffer,
|  | int | len )
| static

handle name lookup replies, add to arp table

## ◆ arp_lookup()

int arp_lookup | ( | struct sockaddr_at * | sat,
|  | uint32_t | ip )
| static

find AT address for an IP address

## ◆ arp_set()

void arp_set | ( | uint32_t | ip,
|  | struct sockaddr_at * | sat )
| static

Set AT address from received packet

## ◆ cksum()

uint16_t cksum | ( | char * | buffer,
|  | int | len )
| static

## ◆ config_input()

void config_input | ( | ATP | atp,
|  | struct sockaddr_at * | faddr,
|  | char * | packet,
|  | int | len )
| static

handle configuration ATP request

## ◆ get_ipent()

struct ipent * get_ipent | ( | uint32_t | ip | ) |

## ◆ get_zones()

int get_zones | ( | void |  | ) |
| static

## ◆ icmp_echo()

void icmp_echo | ( | uint32_t | src,
|  | uint32_t | dst )
| static

## ◆ init_ip()

int init_ip | ( | uint32_t | net,
|  | uint32_t | mask,
|  | uint32_t | nameserver )
| static

## ◆ ip_input()

void ip_input | ( | struct sockaddr_at * | sat,
|  | char * | buffer,
|  | int | len )
| static

handle incoming IP packet

## ◆ lease_ip()

uint32_t lease_ip | ( |  | ) |
| static

aquire a new ip address from the pool

## ◆ macip_close()

void macip_close | ( | void |  | ) |

## ◆ macip_idle()

void macip_idle | ( | void |  | ) |

time out old arp entries

## ◆ macip_input()

void macip_input | ( | void |  | ) |

Handle incoming AT packet

## ◆ macip_open()

int macip_open | ( | char * | zone,
|  | uint32_t | net,
|  | uint32_t | mask,
|  | uint32_t | ns,
|  | outputfunc_t | o )

## ◆ macip_output()

void macip_output | ( | char * | buffer,
|  | int | len )

send IP packet through AT

## ◆ now()

long now | ( | void |  | ) |
| static

## Variable Documentation

## ◆ gMacip

struct macip_data gMacip
| static

## ◆ gOutput

outputfunc_t gOutput
| static

## ◆ gZones

struct zones gZones
| static