📄 siputil.cpp
字号:
#include <sys/types.h>#include <sys/stat.h>#include <sys/utsname.h>#include <sys/socket.h>#include <sys/time.h>#include <sys/errno.h>#include <sys/ioctl.h>#include <net/if_arp.h>#include <net/route.h>#include <net/if.h>#include <netinet/in.h>#include <arpa/inet.h>#include <qobject.h>#include <qmessagebox.h>#include <netdb.h>#include <fcntl.h>#include <stdio.h>#include <unistd.h>#include <stdlib.h>#include <string.h>#include "siputil.h"static char *dissipate_our_fqdn = NULL;/* max number of network interfaces*/#define MAX_IF 5/* Path to the route entry in proc filesystem */#define PROCROUTE "/proc/net/route"/* file containing the hostname of the machine *//* This is the name for slackware and redhat */#define HOSTFILE "/etc/HOSTNAME"/* and this is the name for debian *//* #define HOSTFILE "/etc/HOSTNAME" */#ifndef SIOCGIFCOUNT#define SIOCGIFCOUNT 0x8935#endifchar iface[16];bool SipUtil::checkFilename( const char *filename ){ int fd; fd = open( filename, O_WRONLY ); if ( fd == -1 ) { return false; } // else close( fd ); return true;}/* This searches the proc routing entry for the interface the default gateway
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -