ipc.h

来自「wifi 无线网络路由协议OLSR linux下C代码」· C头文件 代码 · 共 106 行

H
106
字号
/* * OLSR ad-hoc routing table management protocol GUI front-end * Copyright (C) 2003 Andreas T鴑nesen (andreto@ifi.uio.no) * * This file is part of olsr.org. * * uolsrGUI is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * uolsrGUI is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with olsr.org; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * */#include <stdio.h>#include <sys/types.h>#include <sys/socket.h>#include <netdb.h>#include <string.h>#include <arpa/inet.h>#include <unistd.h>#include <fcntl.h>#include <errno.h>#include "olsr_protocol.h"#include "packet.h"#define IPC_PORT 1212#define	IPC_MESSAGE 11    /* IPC to front-end telling of route changes */#define IPC_NET 12       /* IPC to front end net-info *///int ipc_socket;int connected;/* *AND: *IPC message sent to the front-end *at every route update. Both delete *and add */struct routemsg {  olsr_u8_t      msgtype;  olsr_u16_t     size;  olsr_u8_t      metric;  olsr_u8_t      add;  union olsr_ip_addr target_addr;  union olsr_ip_addr gateway_addr;  char           device[4];};struct netmsg{  olsr_u8_t      msgtype;  olsr_u16_t     size;  olsr_u8_t      mids; /* No. of extra interfaces */  olsr_u8_t      hnas; /* No. of HNA nets */  olsr_u8_t      unused1;  olsr_u16_t     hello_int;  olsr_u16_t     hello_lan_int;  olsr_u16_t     tc_int;  olsr_u16_t     neigh_hold;  olsr_u16_t     topology_hold;  olsr_u8_t      ipv6;  union olsr_ip_addr   main_addr;};/* *Private functions */intipc_get_socket();intipc_evaluate_message(union olsr_message *);intipc_eval_route_packet(struct routemsg *);intipc_eval_net_info(struct netmsg *);intprocess_hello(int, olsr_u8_t, union olsr_ip_addr *, union hello_message *);intprocess_tc(int, olsr_u8_t, union olsr_ip_addr *, union tc_message *);intprocess_mid(int, olsr_u8_t, union olsr_ip_addr *, union mid_message *);intprocess_hna(int, olsr_u8_t, union olsr_ip_addr *, union hna_message *);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?