jingle-filetransfer/filetransfer.h
author Nicolas Cornu <nicolas.cornu@ensi-bourges.fr>
Mon, 16 Aug 2010 18:33:33 +0200
changeset 133 361d8577ebd1
parent 131 943c3f938cb4
child 138 dde8eaf7ff2c
permissions -rw-r--r--
Change the way IBB work

#ifndef __JINGLEFT_H__
#define __JINGLEFT_H__ 1

#define NS_JINGLE_APP_FT      "urn:xmpp:jingle:apps:file-transfer:1"
#define NS_JINGLE_APP_FT_INFO "urn:xmpp:jingle:apps:file-transfer:info:1"
#define NS_SI_FT              "http://jabber.org/protocol/si/profile/file-transfer"
#define JINGLE_FT_SIZE_READ 2048

typedef enum {
  JINGLE_FT_OFFER,
  JINGLE_FT_REQUEST,
} JingleFTType;

typedef enum {
  JINGLE_FT_INCOMING,
  JINGLE_FT_OUTGOING
} JingleFTDirection;

typedef enum {
  JINGLE_FT_PENDING,
  JINGLE_FT_STARTING,
  JINGLE_FT_ENDING,
  JINGLE_FT_REJECT,
  JINGLE_FT_ERROR
} JingleFTState;

typedef struct {
  /* the last modification of the file, optional */
  time_t date;

  /* MD5 hash of the file, optional */
  gchar *hash;

  /* the name of the file that the sender wishes to send */
  gchar *name;

  /* the size, in bytes, of the data to be sent */
  guint64 size;

  /* Data already send/receive*/
  guint64 transmit;
  
  /* descriptor to the output file */
  GIOChannel *outfile;
  
  /* Is it an offer or a request ? */
  JingleFTType type;
  
  /* Is it if the file is incoming or outgoing */
  JingleFTDirection dir;
  
  /* The state of the file (PENDING, STARTING, ...) */
  JingleFTState state;
  
  /* A little description of the transfer */
  gchar *desc;
  
  /* Where we compute the hash */
  GChecksum *md5;
  
} JingleFT;

typedef struct {
  int index;
  
  JingleFT *jft;
} JingleFTInfo;
#endif