ELinks 0.18.0
Data Structures | Functions | Variables
common.c File Reference
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include "elinks.h"
#include "main/select.h"
#include "network/connection.h"
#include "protocol/bittorrent/common.h"
#include "session/download.h"
#include "util/conv.h"
#include "util/error.h"
#include "util/lists.h"
#include "util/memory.h"
#include "util/random.h"
#include "util/sha1.h"
#include "util/string.h"
#include "util/snprintf.h"
Include dependency graph for common.c:

Data Structures

struct  bittorrent_fetcher
 
struct  bittorrent_blacklist_item
 

Functions

char * get_peer_id (bittorrent_id_T peer_id)
 
const char * get_peer_message (bittorrent_message_id_T message_id)
 
char * get_hexed_bittorrent_id (bittorrent_id_T id)
 
int bittorrent_piece_is_valid (struct bittorrent_meta *meta, uint32_t piece, char *data, uint32_t datalen)
 
void done_bittorrent_meta (struct bittorrent_meta *meta)
 
void done_bittorrent_message (struct bittorrent_message *message)
 
void init_bittorrent_peer_id (bittorrent_id_T peer_id)
 
int bittorrent_id_is_known (struct bittorrent_connection *bittorrent, bittorrent_id_T id)
 
struct bittorrent_peer * get_peer_from_bittorrent_pool (struct bittorrent_connection *bittorrent, bittorrent_id_T id)
 
enum bittorrent_state add_peer_to_bittorrent_pool (struct bittorrent_connection *bittorrent, bittorrent_id_T id, int port, const char *ip, int iplen)
 
struct bittorrent_peer_request * get_bittorrent_peer_request (struct bittorrent_peer_status *status, uint32_t piece, uint32_t offset, uint32_t length)
 
void add_bittorrent_peer_request (struct bittorrent_peer_status *status, uint32_t piece, uint32_t offset, uint32_t length)
 
void del_bittorrent_peer_request (struct bittorrent_peer_status *status, uint32_t piece, uint32_t offset, uint32_t length)
 
static void bittorrent_fetch_callback (struct download *download, void *data)
 
struct bittorrent_fetcher * init_bittorrent_fetch (struct bittorrent_fetcher **fetcher_ref, struct uri *uri, bittorrent_fetch_callback_T callback, void *data, int delete_)
 
static void end_bittorrent_fetch (void *fetcher_data)
 
void done_bittorrent_fetch (struct bittorrent_fetcher **fetcher_ref)
 
static struct bittorrent_blacklist_item * get_bittorrent_blacklist_item (bittorrent_id_T peer_id)
 
void add_bittorrent_blacklist_flags (bittorrent_id_T peer_id, bittorrent_blacklist_flags_T flags)
 
void del_bittorrent_blacklist_flags (bittorrent_id_T peer_id, bittorrent_blacklist_flags_T flags)
 
bittorrent_blacklist_flags_T get_bittorrent_blacklist_flags (bittorrent_id_T peer_id)
 
void done_bittorrent_blacklist (void)
 

Variables

const bittorrent_id_T BITTORRENT_NULL_ID = {}
 Special peer ID used for determining whether an ID has been set.
 
static struct bittorrent_blacklist_item list bittorrent_blacklist = { D_LIST_HEAD_EL( bittorrent_blacklist ) }
 

Function Documentation

◆ add_bittorrent_blacklist_flags()

void add_bittorrent_blacklist_flags ( bittorrent_id_T  peer_id,
bittorrent_blacklist_flags_T  flags 
)

◆ add_bittorrent_peer_request()

void add_bittorrent_peer_request ( struct bittorrent_peer_status *  status,
uint32_t  piece,
uint32_t  offset,
uint32_t  length 
)

◆ add_peer_to_bittorrent_pool()

enum bittorrent_state add_peer_to_bittorrent_pool ( struct bittorrent_connection *  bittorrent,
bittorrent_id_T  id,
int  port,
const char *  ip,
int  iplen 
)

◆ bittorrent_fetch_callback()

static void bittorrent_fetch_callback ( struct download *  download,
void *  data 
)
static

◆ bittorrent_id_is_known()

int bittorrent_id_is_known ( struct bittorrent_connection *  bittorrent,
bittorrent_id_T  id 
)

◆ bittorrent_piece_is_valid()

int bittorrent_piece_is_valid ( struct bittorrent_meta *  meta,
uint32_t  piece,
char *  data,
uint32_t  datalen 
)

◆ del_bittorrent_blacklist_flags()

void del_bittorrent_blacklist_flags ( bittorrent_id_T  peer_id,
bittorrent_blacklist_flags_T  flags 
)

◆ del_bittorrent_peer_request()

void del_bittorrent_peer_request ( struct bittorrent_peer_status *  status,
uint32_t  piece,
uint32_t  offset,
uint32_t  length 
)

◆ done_bittorrent_blacklist()

void done_bittorrent_blacklist ( void  )

◆ done_bittorrent_fetch()

void done_bittorrent_fetch ( struct bittorrent_fetcher **  fetcher_ref)

◆ done_bittorrent_message()

void done_bittorrent_message ( struct bittorrent_message *  message)

◆ done_bittorrent_meta()

void done_bittorrent_meta ( struct bittorrent_meta *  meta)

◆ end_bittorrent_fetch()

static void end_bittorrent_fetch ( void *  fetcher_data)
static

◆ get_bittorrent_blacklist_flags()

bittorrent_blacklist_flags_T get_bittorrent_blacklist_flags ( bittorrent_id_T  peer_id)

◆ get_bittorrent_blacklist_item()

static struct bittorrent_blacklist_item * get_bittorrent_blacklist_item ( bittorrent_id_T  peer_id)
static

◆ get_bittorrent_peer_request()

struct bittorrent_peer_request * get_bittorrent_peer_request ( struct bittorrent_peer_status *  status,
uint32_t  piece,
uint32_t  offset,
uint32_t  length 
)

◆ get_hexed_bittorrent_id()

char * get_hexed_bittorrent_id ( bittorrent_id_T  id)

◆ get_peer_from_bittorrent_pool()

struct bittorrent_peer * get_peer_from_bittorrent_pool ( struct bittorrent_connection *  bittorrent,
bittorrent_id_T  id 
)

◆ get_peer_id()

char * get_peer_id ( bittorrent_id_T  peer_id)

◆ get_peer_message()

const char * get_peer_message ( bittorrent_message_id_T  message_id)

◆ init_bittorrent_fetch()

struct bittorrent_fetcher * init_bittorrent_fetch ( struct bittorrent_fetcher **  fetcher_ref,
struct uri *  uri,
bittorrent_fetch_callback_T  callback,
void *  data,
int  delete_ 
)

◆ init_bittorrent_peer_id()

void init_bittorrent_peer_id ( bittorrent_id_T  peer_id)

Variable Documentation

◆ bittorrent_blacklist

struct bittorrent_blacklist_item list bittorrent_blacklist = { D_LIST_HEAD_EL( bittorrent_blacklist ) }
static

◆ BITTORRENT_NULL_ID

const bittorrent_id_T BITTORRENT_NULL_ID = {}

Special peer ID used for determining whether an ID has been set.