Changeset dce3903 for protocols/ft.h


Ignore:
Timestamp:
2007-12-04T00:48:57Z (16 years ago)
Author:
ulim <a.sporto+bee@…>
Branches:
master
Children:
8076ec0, fa30fa5
Parents:
2ff2076
Message:

Send and receive seems to work now! Also adopted the new buffering strategy,
only one buffer of 2k per transfer now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/ft.h

    r2ff2076 rdce3903  
    2626#ifndef _FT_H
    2727#define _FT_H
     28
     29/*
     30 * One buffer is needed for each transfer. The receiver stores a message
     31 * in it and gives it to the sender. The sender will stall the receiver
     32 * till the buffer has been sent out.
     33 */
     34#define FT_BUFFER_SIZE 2048
    2835
    2936typedef enum {
     
    131138       
    132139        /*
    133          * If set, called when the transfer queue is running empty and
    134          * more data can be added.
     140         * called by the sending side to indicate that it is writable.
     141         * The callee should check if data is available and call the
     142         * function(as seen below) if that is the case.
    135143         */
    136         void (*out_of_data) ( struct file_transfer *file );
     144        gboolean (*write_request) ( struct file_transfer *file );
    137145
    138146        /*
    139147         * When sending files, protocols register this function to receive data.
     148         * This should only be called once after write_request is called. The caller
     149         * should not read more data until write_request is called again. This technique
     150         * avoids buffering.
    140151         */
    141         gboolean (*write) (struct file_transfer *file, char *buffer, int len );
     152        gboolean (*write) (struct file_transfer *file, char *buffer, unsigned int len );
     153
     154        /* The send buffer associated with this transfer.
     155         * Since receivers always wait for a write_request call one is enough.
     156         */
     157        char buffer[FT_BUFFER_SIZE];
    142158
    143159} file_transfer_t;
     
    154170void imcb_file_canceled( file_transfer_t *file, char *reason );
    155171
    156 /*
    157  * The given buffer is queued for transfer and MUST NOT be freed by the caller.
    158  * When the method returns false the caller should not invoke this method again
    159  * until out_of_data has been called.
    160  */
    161 gboolean imcb_file_write( file_transfer_t *file, gpointer data, size_t data_size );
    162 
    163172gboolean imcb_file_recv_start( file_transfer_t *ft );
    164173#endif
Note: See TracChangeset for help on using the changeset viewer.