File: iplist.h

package info (click to toggle)
ctorrent 1.3.4.dnh3.3.2-5
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 1,240 kB
  • sloc: cpp: 13,161; sh: 675; ansic: 383; makefile: 6
file content (38 lines) | stat: -rw-r--r-- 783 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef IPLIST_H
#define IPLIST_H

#include "def.h"

#ifdef WINDOWS
#include <Winsock2.h>
#else
#include <unistd.h>
#include <stdio.h>   // autoconf manual: Darwin + others prereq for stdlib.h
#include <stdlib.h>  // autoconf manual: Darwin prereq for sys/socket.h
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#endif

typedef struct _iplist{
  struct sockaddr_in address;
  struct _iplist *next;
}IPLIST;

class IpList
{
private:
  IPLIST *ipl_head;
  size_t count;
  void _Emtpy();
public:
  IpList() { ipl_head = (IPLIST*)0; count = 0;}
  ~IpList() { if(ipl_head) _Emtpy(); }
  int Add(const struct sockaddr_in* psin);
  int Pop(struct sockaddr_in* psin);
  int IsEmpty() { return count ? 0 : 1; }
};

extern IpList IPQUEUE;
#endif