loopback.c

来自「一个基于linux的TCP/IP协议栈的实现」· C语言 代码 · 共 48 行

C
48
字号
/* loopback.c * linqianghe@163.com * 2006-10-20 */#include "config.h"#include <sys/types.h>#include <sys/socket.h>#include <net/if_arp.h>#include <stdlib.h>#include <stdio.h>#include <errno.h>#include <ctype.h>#include <string.h>#include <unistd.h>#include "net-support.h"#include "pathnames.h"//#include "intl.h"#include "util.h"/* Display an UNSPEC address. */static char *pr_unspec(unsigned char *ptr){    static char buff[64];    char *pos;    unsigned int i;    pos = buff;    for (i = 0; i < sizeof(struct sockaddr); i++) {	pos += sprintf(pos, "%02X-", (*ptr++ & 0377));    }    buff[strlen(buff) - 1] = '\0';    return (buff);}struct hwtype unspec_hwtype ={    "unspec", NULL, /*"UNSPEC", */ -1, 0,    pr_unspec, NULL, NULL};struct hwtype loop_hwtype ={    "loop", NULL, /*"Local Loopback", */ ARPHRD_LOOPBACK, 0,    NULL, NULL, NULL};

⌨️ 快捷键说明

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