File src/dinoex_upload.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_upload.c,v 1.55 2011/12/09 12:36:32 cvs Exp $ *


Included Files

include the headers


Preprocessor definitions

#define _LONGLONG 1

Global Function clean_uploadhost()

remove temp uploadhosts

void clean_uploadhost ( void )

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

Global Function file_uploading()

check if a filename is already in a upload

unsigned int file_uploading ( const char* file )

Prototyped in: src/dinoex_upload.h
Calls: fetch_is_running() src/dinoex_curl.c
  irlist_get_head() src/iroffer_utilities.c
  irlist_get_next() src/iroffer_utilities.c
  strcmp()
Called by: a_adddir_sub() src/dinoex_admin.c
  is_upload_file() src/dinoex_admin.c
  upload_start() src/dinoex_upload.c
References Variables: gdata src/dinoex_main.c

Global Function get_uploaddir()

returns custom uploaddir or default

char* get_uploaddir ( const char* hostmask )

Prototyped in: src/dinoex_upload.h
Calls: verifyupload_group() src/dinoex_upload.c
Called by: a_valid_uploaddir() src/dinoex_admin.c
  upload_start() src/dinoex_upload.c
References Variables: gdata src/dinoex_main.c

Global Function invalid_upload()

check for valid upload user and size

unsigned int invalid_upload ( const char* nick, const char* hostmask, off_t len )

Prototyped in: src/dinoex_upload.h
Calls: error_upload_start() src/dinoex_upload.c
  ioutput() src/iroffer_utilities.c
  notice() src/iroffer_utilities.c
  updatecontext_f() src/iroffer_utilities.c
  verify_uploadhost() src/dinoex_upload.c
Called by: command_dcc() src/dinoex_user.c
  upload_start() src/dinoex_upload.c
References Variables: gdata src/dinoex_main.c
  gnetwork src/dinoex_main.c

Global Function l_perform()

perfrom io for upload

void l_perform ( int changesec )

Prototyped in: src/dinoex_upload.h
Calls: close_qupload() src/dinoex_jobs.c
  ioutput() src/iroffer_utilities.c
  irlist_delete() src/iroffer_utilities.c
  irlist_get_head() src/iroffer_utilities.c
  irlist_get_next() src/iroffer_utilities.c
  l_closeconn() src/iroffer_upload.c
  l_istimeout() src/iroffer_upload.c
  l_setup_accept() src/dinoex_upload.c
  l_transfersome() src/iroffer_upload.c
  mydelete2() src/iroffer_utilities.c
  notice() src/iroffer_utilities.c
  outerror() src/iroffer_utilities.c
  updatecontext_f() src/iroffer_utilities.c
  __error(), getsockopt(), strerror()
Called by: mainloop() src/iroffer_main.c
References Variables: gdata src/dinoex_main.c
  gnetwork src/dinoex_main.c

Global Function l_print_state()

returns a text for the state of the upload

const char* l_print_state ( upload* const l )

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

Global Function l_select_fdset()

register active connections for select()

int l_select_fdset ( int highests, int changequartersec )

Prototyped in: src/dinoex_upload.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 l_setup_file()

open file on disk for upload

int l_setup_file ( upload* const l, struct stat* stp )

Prototyped in: src/dinoex_upload.h
Calls: l_closeconn() src/iroffer_upload.c
  mydelete2() src/iroffer_utilities.c
  mystrjoin2() src/dinoex_utilities.c
  outerror() src/iroffer_utilities.c
  updatecontext_f() src/iroffer_utilities.c
  __error(), close(), open(), stat(), strerror()
Called by: l_establishcon() src/iroffer_upload.c
  l_setup_passive() src/dinoex_upload.c

Global Function l_setup_passive()

open new port for incoming connection

int l_setup_passive ( upload* const l, char* token )

Prototyped in: src/dinoex_upload.h
Calls: getsendname() src/iroffer_misc.c
  l_setup_file() src/dinoex_upload.c
  l_setup_listen() src/dinoex_upload.c
  mydelete2() src/iroffer_utilities.c
  privmsg_fast() src/iroffer_utilities.c
  updatecontext_f() src/iroffer_utilities.c
  atoi(), strlen()
Called by: command_dcc() src/dinoex_user.c
  upload_start() src/dinoex_upload.c
References Variables: gdata src/dinoex_main.c

Global Function upload_start()

check permissions and setup the upload transfer

void upload_start ( const char* nick, const char* hostname, const char* hostmask, const char* filename, const char* remoteip, const char* remoteport, const char* bytes, char* token )

Prototyped in: src/dinoex_upload.h
Calls: atoull() src/iroffer_utilities.c
  disk_full() src/dinoex_misc.c
  error_upload_start() src/dinoex_upload.c
  file_uploading() src/dinoex_upload.c
  get_uploaddir() src/dinoex_upload.c
  getfilename() src/dinoex_utilities.c
  getsendname() src/iroffer_misc.c
  invalid_upload() src/dinoex_upload.c
  ioutput() src/iroffer_utilities.c
  irlist_add2() src/iroffer_utilities.c
  irlist_size() src/iroffer_utilities.c
  l_establishcon() src/iroffer_upload.c
  l_initvalues() src/iroffer_upload.c
  l_setup_passive() src/dinoex_upload.c
  mydelete2() src/iroffer_utilities.c
  mystrdup2() src/dinoex_utilities.c
  updatecontext_f() src/iroffer_utilities.c
  atoi(), strchr()
Called by: command_dcc() src/dinoex_user.c
References Variables: gdata src/dinoex_main.c
  gnetwork src/dinoex_main.c

Local Function error_upload_start()

static void error_upload_start ( const char* nick, const char* hostmask, const char* key, const char* msg )
Calls: ioutput() src/iroffer_utilities.c
  notice() src/iroffer_utilities.c
Called by: invalid_upload() src/dinoex_upload.c
  upload_start() src/dinoex_upload.c
References Variables: gnetwork src/dinoex_main.c

Local Function l_setup_accept()

accept incoming connection

static void l_setup_accept ( upload* const l )

Calls: event_close() src/dinoex_kqueue.c
  get_port() src/dinoex_utilities.c
  ioutput() src/iroffer_utilities.c
  ir_listen_port_connected() src/iroffer_utilities.c
  ir_setsockopt() src/dinoex_irc.c
  l_closeconn() src/iroffer_upload.c
  my_getnameinfo() src/dinoex_irc.c
  mydelete2() src/iroffer_utilities.c
  mymalloc2() src/iroffer_utilities.c
  mystrdup2() src/dinoex_utilities.c
  notice() src/iroffer_utilities.c
  outerror() src/iroffer_utilities.c
  updatecontext_f() src/iroffer_utilities.c
  __error(), accept(), strerror()
Called by: l_perform() src/dinoex_upload.c
References Variables: gdata src/dinoex_main.c

Local Function l_setup_listen()

static int l_setup_listen ( upload* const l )
Calls: getsendname() src/iroffer_misc.c
  ioutput() src/iroffer_utilities.c
  irc_open_listen() src/dinoex_irc.c
  l_closeconn() src/iroffer_upload.c
  my_getnameinfo() src/dinoex_irc.c
  mydelete2() src/iroffer_utilities.c
  mymalloc2() src/iroffer_utilities.c
  privmsg_fast() src/iroffer_utilities.c
  setup_dcc_local() src/dinoex_irc.c
  updatecontext_f() src/iroffer_utilities.c
Called by: l_setup_passive() src/dinoex_upload.c
References Variables: gnetwork src/dinoex_main.c

Local Function verify_uploadhost()

check if this host is allowed to send

static int verify_uploadhost ( const char* hostmask )

Calls: irlist_get_head() src/iroffer_utilities.c
  irlist_get_next() src/iroffer_utilities.c
  updatecontext_f() src/iroffer_utilities.c
  verifyshell() src/dinoex_utilities.c
  verifyupload_group() src/dinoex_upload.c
  fnmatch()
Called by: invalid_upload() src/dinoex_upload.c
References Variables: gdata src/dinoex_main.c
  gnetwork src/dinoex_main.c

Local Function verifyupload_group()

search for a custom uploaddir of a group admin

static char* verifyupload_group ( const char* hostmask )

Calls: irlist_get_head() src/iroffer_utilities.c
  irlist_get_next() src/iroffer_utilities.c
  updatecontext_f() src/iroffer_utilities.c
  fnmatch()
Called by: get_uploaddir() src/dinoex_upload.c
  verify_uploadhost() src/dinoex_upload.c
References Variables: gdata src/dinoex_main.c