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

test_class.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 TEST_CLASS_H
/** Defined when <test_class.h> has been included. */
#define TEST_CLASS_H 

/**@ingroup test_msg
 * @file test_class.h
 * @brief Message and header classes for testing.
 *
 * @author Pekka Pessi <Pekka.Pessi@nokia.com>
 *
 * @date Created: Thu Jun 29 15:58:06 2000 ppessi
 */

#ifndef URL_H
#include <sofia-sip/url.h>
#endif
#ifndef MSG_H
#include <sofia-sip/msg.h>
#endif
#ifndef MSG_HEADER_H
#include <sofia-sip/msg_header.h>
#endif
#ifndef MSG_MIME_H
#include <sofia-sip/msg_mime.h>
#endif
#ifndef MSG_MCLASS_H
#include <sofia-sip/msg_mclass.h>
#endif

SOFIA_BEGIN_DECLS

#define MSG_TEST_PROTOCOL_TAG ((void *)(size_t)0xdeadbeef)

#define MSG_TEST_VERSION_CURRENT "msg/1.0"

extern msg_mclass_t const msg_test_mclass[1];

extern msg_href_t const msg_content_length_href[1];

typedef struct msg_request_s msg_request_t;
typedef struct msg_status_s  msg_status_t;

/** Request line. */
00068 struct msg_request_s { 
00069   msg_common_t     rq_common[1];   /**< Common fragment info */
00070   msg_header_t    *rq_next;      /**< Link to next header */
00071   char const      *rq_method_name; /**< Method name */
00072   url_t            rq_url[1];    /**< RequestURI */
00073   char const      *rq_version;     /**< Protocol version */
}; 

/** Status line. */
00077 struct msg_status_s { 
00078   msg_common_t   st_common[1];      /**< Common fragment info */
00079   msg_header_t *st_next;      /**< Link to next (dummy) */
00080   char const    *st_version;  /**< Protocol version */
00081   int            st_status;   /**< Status code */
00082   char const    *st_phrase;   /**< Status phrase */
};

/** Message object for tests. */
00086 typedef struct msg_test_s {
00087   msg_common_t        msg_common[1]; /**< For recursive inclusion */
  msg_pub_t          *msg_next;
00089   void               *msg_user;          /**< User data */
  unsigned            msg_size;
  unsigned            msg_flags;
  msg_error_t        *msg_error;

  msg_request_t      *msg_request;
  msg_status_t       *msg_status;

  /* === Headers start here */
00098   msg_content_type_t     *msg_content_type;     /**< Content-Type */
  msg_content_disposition_t *msg_content_disposition;
00100                                                 /**< Content-Disposition */
00101   msg_content_location_t *msg_content_location; /**< Content-Location */
00102   msg_content_language_t *msg_content_language; /**< Content-Language */

00104   msg_accept_t           *msg_accept;           /**< Accept */
00105   msg_accept_charset_t   *msg_accept_charset;   /**< Accept-Charset */
00106   msg_accept_encoding_t  *msg_accept_encoding;  /**< Accept-Encoding */
00107   msg_accept_language_t  *msg_accept_language;  /**< Accept-Language */
00108   msg_mime_version_t     *msg_mime_version;     /**< MIME-Version */
00109   msg_content_md5_t      *msg_content_md5;      /**< Content-MD5 */
  msg_content_encoding_t *msg_content_encoding; 
00111                                     /**< Content-Encoding */
00112   msg_content_length_t   *msg_content_length;   /**< Content-Length */

00114   msg_auth_t             *msg_auth;             /**< Auth (testing) */
00115   msg_numeric_t          *msg_numeric;          /**< Numeric (testing) */
  /* === Headers end here */

  msg_unknown_t      *msg_unknown;
  msg_separator_t    *msg_separator;
  msg_payload_t      *msg_payload;
  msg_multipart_t    *msg_multipart;
} msg_test_t;

union msg_test_u
{
  msg_common_t    sh_common[1];
  struct {
    msg_common_t  shn_common;
    msg_header_t *shn_next;
  }               sh_header_next[1];

  msg_request_t             sh_request[1];
  msg_status_t              sh_status[1];
  msg_accept_t              sh_accept[1];
  msg_accept_charset_t      sh_accept_charset[1];
  msg_accept_encoding_t     sh_accept_encoding[1];
  msg_accept_language_t     sh_accept_language[1];
  msg_content_disposition_t sh_content_disposition[1];
  msg_content_encoding_t    sh_content_encoding[1];
  msg_content_id_t          sh_content_id[1];
  msg_content_md5_t         sh_content_md5[1];
  msg_content_language_t    sh_content_language[1];
  msg_content_length_t      sh_content_length[1]; 
  msg_content_location_t    sh_content_location[1];
  msg_content_type_t        sh_content_type[1];
  msg_mime_version_t        sh_mime_version[1];

  msg_generic_t   sh_generic[1];
  msg_numeric_t   sh_numeric[1];
  msg_list_t      sh_list[1];
  msg_auth_t      sh_auth[1];
  msg_separator_t sh_separator[1];
  msg_payload_t   sh_payload[1];
  msg_unknown_t   sh_unknown[1];
};

issize_t msg_test_extract_body(msg_t *, msg_pub_t *,
                         char b[], isize_t bsiz, int eos);

su_inline
msg_test_t *msg_test_public(msg_t *msg)
{
  return (msg_test_t *)msg_public(msg, MSG_TEST_PROTOCOL_TAG);
}

#define msg_auth_class test_auth_class

#define msg_numeric_class test_numeric_class

enum {
  msg_auth_hash = 22894,
  msg_numeric_hash = 24435
};

extern msg_hclass_t test_auth_class[1], test_numeric_class[1];

SOFIA_END_DECLS

#endif /* !defined(TEST_CLASS_H) */

Generated by  Doxygen 1.6.0   Back to index