ioctl.c

来自「cipe 编程」· C语言 代码 · 共 67 行

C
67
字号
/*   CIPE - encrypted IP over UDP tunneling   ioctl.c - ioctl interface, user side   Copyright 1996 Olaf Titz <olaf@bigred.inka.de>   This program 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.*//* $Id: ioctl.c,v 1.7 2002/05/30 11:40:16 olaf Exp $ */#include "cipe.h"#include "ioctl.h"#include "version.h"#include <string.h>#include <sys/ioctl.h>#define IFRSETUP                                                        \    struct ifreq ifr;                                                   \    strcpy(ifr.ifr_name, ifname);                                       \    sio->magic=VERSION_MAGIC;                                           \    ifr.ifr_data=(void*)sio;#ifdef SIOCGIFCIPPARint ioctl_getpar(int fd, char *ifname, struct siocgifcippar *sio){    IFRSETUP;    return ioctl(fd, SIOCGIFCIPPAR, &ifr);}#endifint ioctl_setpar(int fd, char *ifname, struct siocsifcippar *sio){    IFRSETUP;    return ioctl(fd, SIOCSIFCIPPAR, &ifr);}int ioctl_setkey(int fd, char *ifname, struct siocsifcipkey *sio){    int e;    IFRSETUP;    e=ioctl(fd, SIOCSIFCIPKEY, &ifr);    memset(sio, 0, sizeof(*sio));    return e;}int ioctl_attach(int fd, char *ifname, struct siocsifcipatt *sio){    IFRSETUP;    return ioctl(fd, SIOCSIFCIPATT, &ifr);}int ioctl_alloc(int fd, char *ifname, struct siocsifcipall *sio){    IFRSETUP;    return ioctl(fd, SIOCSIFCIPALL, &ifr);}int ioctl_unalloc(int fd, char *ifname, struct siocsifcipall *sio){    IFRSETUP;    return ioctl(fd, SIOCSIFCIPUNA, &ifr);}

⌨️ 快捷键说明

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