Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/ft.h

    rdce3903 r2c2df7d  
    2727#define _FT_H
    2828
    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
    35 
    3629typedef enum {
    3730        FT_STATUS_LISTENING     = 1,
    38         FT_STATUS_TRANSFERRING  = 2,
     31        FT_STATUS_TRANSFERING   = 2,
    3932        FT_STATUS_FINISHED      = 4,
    40         FT_STATUS_CANCELED      = 8,
    41         FT_STATUS_CONNECTING    = 16
     33        FT_STATUS_CANCELED      = 8
    4234} file_status_t;
    4335
     
    6961 */
    7062typedef struct file_transfer {
    71 
    72         /* Are we sending something? */
    73         int sending;
    74 
    7563        /*
    7664         * The current status of this file transfer.
     
    138126       
    139127        /*
    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.
     128         * If set, called when the transfer queue is running empty and
     129         * more data can be added.
    143130         */
    144         gboolean (*write_request) ( struct file_transfer *file );
    145 
    146         /*
    147          * 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.
    151          */
    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];
     131        void (*out_of_data) ( struct file_transfer *file );
    158132
    159133} file_transfer_t;
     
    170144void imcb_file_canceled( file_transfer_t *file, char *reason );
    171145
    172 gboolean imcb_file_recv_start( file_transfer_t *ft );
     146/*
     147 * The given buffer is queued for transfer and MUST NOT be freed by the caller.
     148 * When the method returns false the caller should not invoke this method again
     149 * until out_of_data has been called.
     150 */
     151gboolean imcb_file_write( file_transfer_t *file, gpointer data, size_t data_size );
     152
    173153#endif
Note: See TracChangeset for help on using the changeset viewer.