⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iplist.cpp

📁 linux下最常用的bt下载软件的最新源代码
💻 CPP
字号:
#include <string.h>#include "iplist.h"IpList IPQUEUE;void IpList::_Emtpy(){  IPLIST *node = ipl_head;  for(; ipl_head;){    node = ipl_head;    delete ipl_head;    ipl_head = node->next;  }  count = 0;}int IpList::Add(const struct sockaddr_in *psin){  IPLIST *node = ipl_head;  for(; node; node = node->next)    if(memcmp(psin, &node->address, sizeof(struct sockaddr_in)) == 0) break;  if( node ) return -1;  // if not exist;  node = new IPLIST;#ifndef WINDOWS  if( !node ) return -1;#endif  count++;  memcpy(&node->address,psin,sizeof(struct sockaddr_in));  node->next = ipl_head;  ipl_head = node;  return 0;}int IpList::Pop(struct sockaddr_in *psin){  IPLIST *node = (IPLIST*) 0;  if(!ipl_head) return -1;  node = ipl_head;  ipl_head = ipl_head->next;  count--;  memcpy(psin, &node->address, sizeof(struct sockaddr_in));  delete node;  return 0;}

⌨️ 快捷键说明

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