Logo Search packages:      
Sourcecode: sofia-sip version File versions

msg_mime.h

Go to the documentation of this file.
/*
 * This file is part of the Sofia-SIP package
 *
 * Copyright (C) 2005 Nokia Corporation.
 *
 * Contact: Pekka Pessi <pekka.pessi@nokia.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 *
 */

#ifndef MSG_MIME_H
/** Defined when <sofia-sip/msg_mime.h> has been included. */
#define MSG_MIME_H

/**@ingroup msg_mime
 * @file sofia-sip/msg_mime.h
 *
 * MIME headers and multipart messages (@RFC2045).
 *
 * @author Pekka Pessi <Pekka.Pessi@nokia.com>
 *
 * @date Created: Fri Aug 16 19:18:26 EEST 2002 ppessi
 *
 */

#ifndef URL_H
#include <sofia-sip/url.h>
#endif

#ifndef MSG_TYPES_H
#include <sofia-sip/msg_types.h>
#endif
#ifndef SU_TYPES_H
#include <sofia-sip/su_types.h>
#endif

SOFIA_BEGIN_DECLS

typedef struct msg_accept_any_s     msg_accept_any_t;

00055 typedef struct msg_accept_s       msg_accept_t;

00057 typedef msg_accept_any_t            msg_accept_charset_t;
00058 typedef msg_accept_any_t                msg_accept_encoding_t;
00059 typedef msg_accept_any_t          msg_accept_language_t;

00061 typedef struct msg_content_disposition_s
                                    msg_content_disposition_t;
00063 typedef msg_list_t                      msg_content_encoding_t;
00064 typedef msg_generic_t               msg_content_id_t;
00065 typedef struct msg_content_length_s msg_content_length_t;
00066 typedef msg_generic_t               msg_content_location_t;
00067 typedef msg_list_t                  msg_content_language_t;
00068 typedef msg_generic_t               msg_content_md5_t;
00069 typedef msg_generic_t             msg_content_transfer_encoding_t;
00070 typedef struct msg_content_type_s   msg_content_type_t;
00071 typedef msg_generic_t             msg_mime_version_t;
00072 typedef struct msg_warning_s      msg_warning_t;

/** Multipart body object. */
00075 typedef struct msg_multipart_s      msg_multipart_t;

/**@ingroup msg_accept
 * @brief Structure for @b Accept header.
 */
00080 struct msg_accept_s
{
00082   msg_common_t        ac_common[1]; /**< Common fragment info */
00083   msg_accept_t       *ac_next;          /**< Pointer to next Accept header */
00084   char const         *ac_type;          /**< Pointer to type/subtype */
00085   char const         *ac_subtype;   /**< Points after first slash in type */
00086   msg_param_t const  *ac_params;    /**< List of parameters */
00087   char const         *ac_q;       /**< Value of q parameter */
};

/**@ingroup msg_accept_encoding
 * @brief Structure for @b Accept-Charset, @b Accept-Encoding and
 * @b Accept-Language headers.
 */
00094 struct msg_accept_any_s
{
00096   msg_common_t        aa_common[1]; /**< Common fragment info */
00097   msg_accept_any_t   *aa_next;          /**< Pointer to next Accept-* header */
00098   char const         *aa_value;         /**< Token */
00099   msg_param_t const  *aa_params;    /**< List of parameters */
00100   char const         *aa_q;       /**< Value of q parameter */
};

/**@ingroup msg_content_disposition
 * @brief Structure for @b Content-Disposition header.
 */
00106 struct msg_content_disposition_s
{
00108   msg_common_t       cd_common[1];  /**< Common fragment info */
00109   msg_error_t       *cd_next;     /**< Link to next (dummy) */
00110   char const        *cd_type;     /**< Disposition type */
00111   msg_param_t const *cd_params;         /**< List of parameters */
00112   char const        *cd_handling;   /**< Value of @b handling parameter */
00113   unsigned           cd_required:1; /**< True if handling=required */
00114   unsigned           cd_optional:1; /**< True if handling=optional */
  unsigned           :0;          /* pad */
};

/**@ingroup msg_content_length
 * @brief Structure for Content-Length header.
 */
00121 struct msg_content_length_s
{
00123   msg_common_t   l_common[1];     /**< Common fragment info */
00124   msg_error_t   *l_next;          /**< Link to next (dummy) */
00125   unsigned long  l_length;        /**< Digits */
};


/**@ingroup msg_content_type
 * @brief Structure for Content-Type header.
 */
00132 struct msg_content_type_s
{
00134   msg_common_t        c_common[1];  /**< Common fragment info */
00135   msg_error_t        *c_next;     /**< Dummy link to next */
00136   char const         *c_type;     /**< Pointer to type/subtype */
00137   char const         *c_subtype;    /**< Points after first slash in type */
00138   msg_param_t const  *c_params;         /**< List of parameters */
};


/**@ingroup sip_warning
 * @brief Structure for @b Warning header.
 */
00145 struct msg_warning_s
{
00147   msg_common_t        w_common[1];  /**< Common fragment info */
00148   msg_warning_t      *w_next;     /**< Link to next Warning header */
00149   unsigned            w_code;       /**< Warning code */
00150   char const         *w_host;     /**< Hostname or pseudonym */
00151   char const         *w_port;     /**< Port number */
00152   char const         *w_text;       /**< Warning text */
};


/**@ingroup msg_multipart
 *
 * @brief Structure for a part in MIME multipart message.
 */
00160 struct msg_multipart_s
{
00162   msg_common_t            mp_common[1];   /**< Common fragment information */
00163   msg_multipart_t        *mp_next;      /**< Next part in multipart body */
  /* Preamble for this part */
00165   char                   *mp_data;  /**< Boundary string. */
00166   usize_t                 mp_len;   /**< Length of boundary (mp_data).*/
  unsigned                mp_flags;
  msg_error_t            *mp_error;

  /* === Headers start here */
00171   msg_content_type_t     *mp_content_type;      /**< Content-Type */
  msg_content_disposition_t *mp_content_disposition;
00173                                                 /**< Content-Disposition */
00174   msg_content_location_t *mp_content_location;  /**< Content-Location */
00175   msg_content_id_t       *mp_content_id;        /**< Content-ID */
00176   msg_content_language_t *mp_content_language;  /**< Content-Language */
00177   msg_content_encoding_t *mp_content_encoding;  /**< Content-Encoding */
  msg_content_transfer_encoding_t *mp_content_transfer_encoding;
00179                                         /**< Content-Transfer-Encoding */
#if 0
  /* === Hash headers end here */
  /* These MIME headers are here for msg_parser.awk */
  msg_accept_t           *mp_accept;            /**< Accept */
  msg_accept_charset_t   *mp_accept_charset;    /**< Accept-Charset */
  msg_accept_encoding_t  *mp_accept_encoding;   /**< Accept-Encoding */
  msg_accept_language_t  *mp_accept_language;   /**< Accept-Language */
  msg_mime_version_t     *mp_mime_version;      /**< MIME-Version */
  msg_content_md5_t      *mp_content_md5; /**< Content-MD5 */
  msg_content_length_t   *mp_content_length;    /**< Content-Length */
  msg_multipart_t        *mp_multipart;         /**< Recursive multipart */
  msg_warning_t          *mp_warning;           /**< Warning */
#endif
  /* === Headers end here */

  /** Unknown and extra headers. */
00196   msg_unknown_t          *mp_unknown;           /**< Unknown headers */

00198   msg_separator_t        *mp_separator;           /**< Separator */
00199   msg_payload_t          *mp_payload;             /**< Body part */

00201   msg_multipart_t        *mp_multipart;         /**< Recursive multipart */

00203   msg_payload_t          *mp_close_delim;       /**< Closing delimiter */
};

SOFIAPUBFUN
msg_multipart_t *msg_multipart_create(su_home_t *home,
                              char const *content_type,
                              void const *data,
                              isize_t dlen);
SOFIAPUBFUN
msg_multipart_t *msg_multipart_parse(su_home_t *home,
                             msg_content_type_t const *c,
                             msg_payload_t *pl);
SOFIAPUBFUN
int msg_multipart_complete(su_home_t *home,
                     msg_content_type_t *c,
                     msg_multipart_t *mp);
SOFIAPUBFUN msg_header_t *msg_multipart_serialize(msg_header_t **head0,
                                      msg_multipart_t *mp);

SOFIAPUBFUN issize_t msg_multipart_prepare(msg_t *msg, msg_multipart_t *mp, int flags);

SOFIAPUBFUN isize_t msg_accept_any_dup_xtra(msg_header_t const *h, isize_t offset);

SOFIAPUBFUN char *msg_accept_any_dup_one(msg_header_t *dst,
                               msg_header_t const *src,
                               char *b, isize_t xtra);

SOFIAPUBFUN
msg_content_length_t *msg_content_length_create(su_home_t *home, uint32_t n);

/** MIME multipart protocol name. @HIDE */
00234 #define MSG_MULTIPART_VERSION_CURRENT msg_mime_version_1_0
SOFIAPUBVAR char const msg_mime_version_1_0[];

/** MIME multipart parser table identifier. @HIDE */
00238 #define MSG_MULTIPART_PROTOCOL_TAG   ((void *)0x4d494d45)   /* 'MIME' */

SOFIA_END_DECLS

#endif /** MSG_MIME_H */

Generated by  Doxygen 1.6.0   Back to index