File src/dinoex_transfer.c

* by Dirk Meyer (dinoex) * Copyright (C) 2004-2011 Dirk Meyer * * By using this file, you agree to the terms and conditions set * forth in the GNU General Public License. More information is * available in the LICENSE file. * * If you received this file without documentation, it can be * downloaded from http://iroffer.dinoex.net/ * * $Id: dinoex_transfer.c,v 1.63 2011/11/30 05:39:03 cvs Exp $ *


Included Files

include the headers


Preprocessor definitions

#define _LONGLONG 1

Global Function create_transfer()

create a new transfer

transfer* create_transfer ( xdcc* xd, const char* nick, const char* hostname )

Prototyped in: src/dinoex_transfer.h
Calls: caps() src/dinoex_utilities.c
  get_next_tr_id() src/iroffer_utilities.c
  irlist_add2() src/iroffer_utilities.c
  mystrdup2() src/dinoex_utilities.c
  t_initvalues() src/iroffer_transfer.c
Called by: a_send() src/dinoex_admin.c
  send_from_queue() src/dinoex_queue.c
  send_xdcc_file() src/dinoex_misc.c
  send_xdcc_file2() src/dinoex_user.c
References Variables: gdata src/dinoex_main.c
  gnetwork src/dinoex_main.c

Global Function t_check_ip_access()

check ip for matching blacklist and whitelist

unsigned int t_check_ip_access ( transfer* const tr )

Prototyped in: src/dinoex_transfer.h
Calls: ioutput() src/iroffer_utilities.c
  irlist_size() src/iroffer_utilities.c
  t_closeconn() src/iroffer_transfer.c
  verify_cidr() src/dinoex_misc.c
Called by: t_passive() src/dinoex_transfer.c
  t_setup_send() src/iroffer_transfer.c
References Variables: gdata src/dinoex_main.c

Global Function t_find_resume()

search the DDC transfer a user wants to resume

unsigned int t_find_resume ( const char* nick, const char* filename, const char* localport, const char* bytes, char* token )

Prototyped in: src/dinoex_transfer.h
Calls: atoull() src/iroffer_utilities.c
  getsendname() src/iroffer_misc.c
  ioutput() src/iroffer_utilities.c
  irlist_get_head() src/iroffer_utilities.c
  irlist_get_next() src/iroffer_utilities.c
  mydelete2() src/iroffer_utilities.c
  notice() src/iroffer_utilities.c
  outerror() src/iroffer_utilities.c
  privmsg_fast() src/iroffer_utilities.c
  t_find_debug() src/dinoex_transfer.c
  t_setresume() src/iroffer_transfer.c
  atoi(), strcasecmp(), strcasestr()
Called by: command_dcc() src/dinoex_user.c
References Variables: gdata src/dinoex_main.c
  gnetwork src/dinoex_main.c

Global Function t_find_transfer()

search the DDC transfer a user wants to accept

unsigned int t_find_transfer ( const char* nick, const char* filename, const char* remoteip, const char* remoteport, const char* token )

Prototyped in: src/dinoex_transfer.h
Calls: irlist_get_head() src/iroffer_utilities.c
  irlist_get_next() src/iroffer_utilities.c
  mystrdup2() src/dinoex_utilities.c
  t_find_debug() src/dinoex_transfer.c
  t_passive() src/dinoex_transfer.c
  atoi(), strcasecmp()
Called by: command_dcc() src/dinoex_user.c
References Variables: gdata src/dinoex_main.c

Global Function t_notice_transfer()

inform the user that the bot is starting a transfer

void t_notice_transfer ( transfer* const tr, const char* msg, unsigned int pack, unsigned int queue )

Prototyped in: src/dinoex_transfer.h
Calls: mydelete2() src/iroffer_utilities.c
  mymalloc2() src/iroffer_utilities.c
  notice_transfer() src/dinoex_transfer.c
  snprintf()
Called by: a_send() src/dinoex_admin.c
  send_from_queue() src/dinoex_queue.c
  send_xdcc_file2() src/dinoex_user.c
References Variables: gdata src/dinoex_main.c

Global Function t_perform()

handle transfer ip events

void t_perform ( int changesec, int changequartersec )

Prototyped in: src/dinoex_transfer.h
Calls: check_idle_queue() src/dinoex_queue.c
  irlist_delete() src/iroffer_utilities.c
  irlist_get_head() src/iroffer_utilities.c
  irlist_get_next() src/iroffer_utilities.c
  irlist_get_nth() src/iroffer_utilities.c
  irlist_size() src/iroffer_utilities.c
  mydelete2() src/iroffer_utilities.c
  select_starting_transfer() src/dinoex_transfer.c
  send_from_queue() src/dinoex_queue.c
  t_check_new_connection() src/dinoex_transfer.c
  t_connected() src/dinoex_transfer.c
  t_flushed() src/iroffer_transfer.c
  t_istimeout() src/iroffer_transfer.c
  t_readjunk() src/iroffer_transfer.c
  t_remind() src/iroffer_transfer.c
  t_transfersome() src/iroffer_transfer.c
  updatecontext_f() src/iroffer_utilities.c
Called by: mainloop() src/iroffer_main.c
References Variables: gdata src/dinoex_main.c
  gnetwork src/dinoex_main.c

Global Function t_print_state()

returns a text for the state of the download

const char* t_print_state ( transfer* const tr )

Prototyped in: src/dinoex_transfer.h
Called by: u_dcl() src/iroffer_admin.c
  u_dcld() src/iroffer_admin.c
  u_trinfo() src/iroffer_admin.c

Global Function t_select_fdset()

register active connections for select()

int t_select_fdset ( int highests, int changequartersec )

Prototyped in: src/dinoex_transfer.h
Calls: irlist_get_head() src/iroffer_utilities.c
  irlist_get_next() src/iroffer_utilities.c
Called by: mainloop() src/iroffer_main.c
References Variables: gdata src/dinoex_main.c

Global Function t_setup_dcc()

start normal or passive DCC download

void t_setup_dcc ( transfer* tr )

Prototyped in: src/dinoex_transfer.h
Calls: get_local_vhost() src/dinoex_irc.c
  outerror() src/iroffer_utilities.c
  t_setuplisten() src/iroffer_transfer.c
  t_start_dcc_send() src/dinoex_transfer.c
  updatecontext_f() src/iroffer_utilities.c
  __bswap16(), __inet_pton(), bzero()
Called by: a_send() src/dinoex_admin.c
  send_from_queue() src/dinoex_queue.c
  send_xdcc_file() src/dinoex_misc.c
  send_xdcc_file2() src/dinoex_user.c
References Variables: gdata src/dinoex_main.c
  gnetwork src/dinoex_main.c

Global Function t_start_dcc_send()

send DCC command to start download

void t_start_dcc_send ( transfer* tr )

Prototyped in: src/dinoex_transfer.h
Calls: getsendname() src/iroffer_misc.c
  ioutput() src/iroffer_utilities.c
  mydelete2() src/iroffer_utilities.c
  privmsg_fast() src/iroffer_utilities.c
  setup_dcc_local() src/dinoex_irc.c
  updatecontext_f() src/iroffer_utilities.c
  bzero()
Called by: t_remind() src/iroffer_transfer.c
  t_setup_dcc() src/dinoex_transfer.c
References Variables: gdata src/dinoex_main.c
  gnetwork src/dinoex_main.c

Global Function t_unlmited()

check for a match with unlimitedhost

void t_unlmited ( transfer* const tr, const char* hostmask )

Prototyped in: src/dinoex_transfer.h
Calls: mydelete2() src/iroffer_utilities.c
  t_unlmited2() src/dinoex_transfer.c
  to_hostmask() src/dinoex_utilities.c
Called by: a_send() src/dinoex_admin.c
  send_from_queue() src/dinoex_queue.c
  send_xdcc_file2() src/dinoex_user.c

Global Function verify_acknowlede()

find out how many bytes the user has received

unsigned int verify_acknowlede ( transfer* tr )

Prototyped in: src/dinoex_transfer.h
Calls: ioutput() src/iroffer_utilities.c
  outerror() src/iroffer_utilities.c
Called by: t_readjunk() src/iroffer_transfer.c
References Variables: gdata src/dinoex_main.c

Local Function notice_transfer()

static void notice_transfer ( const char* nick, xdcc* xd, const char* msg )
Calls: mydelete2() src/iroffer_utilities.c
  notice_fast() src/iroffer_utilities.c
  sizestr() src/dinoex_utilities.c
Called by: t_notice_transfer() src/dinoex_transfer.c

Local Function select_starting_transfer()

select a transfer to start with

static unsigned int select_starting_transfer ( void )

Calls: irlist_size() src/iroffer_utilities.c
Called by: t_perform() src/dinoex_transfer.c
References Variables: gdata src/dinoex_main.c

Local Function t_check_duplicateip()

check if a transfer will use more connections per user than allowed

static void t_check_duplicateip ( transfer* const newtr )

Calls: get_ignore() src/dinoex_irc.c
  ioutput() src/iroffer_utilities.c
  irlist_get_head() src/iroffer_utilities.c
  irlist_get_next() src/iroffer_utilities.c
  mydelete2() src/iroffer_utilities.c
  queue_punish_abuse() src/dinoex_queue.c
  t_closeconn() src/iroffer_transfer.c
  to_hostmask() src/dinoex_utilities.c
  updatecontext_f() src/iroffer_utilities.c
  write_statefile() src/iroffer_statefile.c
  strcmp()
Called by: t_check_new_connection() src/dinoex_transfer.c
References Variables: gdata src/dinoex_main.c

Local Function t_check_new_connection()

check a new transfer

static void t_check_new_connection ( transfer* const tr )

Calls: geoip_new_connection() src/dinoex_geoip.c
  t_check_duplicateip() src/dinoex_transfer.c
  t_establishcon() src/iroffer_transfer.c
  updatecontext_f() src/iroffer_utilities.c
Called by: t_perform() src/dinoex_transfer.c

Local Function t_connected()

process successful connection

static void t_connected ( transfer* tr )

Calls: ioutput() src/iroffer_utilities.c
  outerror() src/iroffer_utilities.c
  t_closeconn() src/iroffer_transfer.c
  t_setup_send() src/iroffer_transfer.c
  __error(), getsockopt(), strerror()
Called by: t_perform() src/dinoex_transfer.c
References Variables: gdata src/dinoex_main.c
  gnetwork src/dinoex_main.c

Local Function t_find_debug()

static void t_find_debug ( const char* nick, const char* filename, const char* remoteport )
Calls: ioutput() src/iroffer_utilities.c
  irlist_get_head() src/iroffer_utilities.c
  irlist_get_next() src/iroffer_utilities.c
  outerror() src/iroffer_utilities.c
  atoi()
Called by: t_find_resume() src/dinoex_transfer.c
  t_find_transfer() src/dinoex_transfer.c
References Variables: gdata src/dinoex_main.c
  gnetwork src/dinoex_main.c

Local Function t_passive()

static void t_passive ( transfer* const tr, ir_uint16 remoteport )
Calls: atoul() src/iroffer_utilities.c
  bind_irc_vhost() src/dinoex_irc.c
  ioutput() src/iroffer_utilities.c
  my_getnameinfo() src/dinoex_irc.c
  mydelete2() src/iroffer_utilities.c
  mymalloc2() src/iroffer_utilities.c
  outerror() src/iroffer_utilities.c
  set_socket_nonblocking() src/iroffer_utilities.c
  t_check_ip_access() src/dinoex_transfer.c
  t_closeconn() src/iroffer_transfer.c
  updatecontext_f() src/iroffer_utilities.c
  __bswap16(), __bswap32(), __error(), __inet_pton(), alarm(), bzero(), connect(), socket()
Called by: t_find_transfer() src/dinoex_transfer.c
References Variables: gdata src/dinoex_main.c
  gnetwork src/dinoex_main.c

Local Function t_unlmited2()

static void t_unlmited2 ( transfer* const tr, const char* hostmask )
Calls: ioutput() src/iroffer_utilities.c
  verifyshell() src/dinoex_utilities.c
Called by: t_unlmited() src/dinoex_transfer.c
References Variables: gdata src/dinoex_main.c
  gnetwork src/dinoex_main.c