Commit 5f055d91 authored by garciay's avatar garciay
Browse files

Add ITS HTTP support

parent 249fd702
Loading
Loading
Loading
Loading
+62 −0
Original line number Original line Diff line number Diff line
/**
 *    @author   ETSI / STF549
 *    @version  $URL$
 *              $ID:$
 *    @desc     This module provides the templates for ITS HTTP based protocols.
 *    @copyright   ETSI Copyright Notification
 *                 No part may be reproduced except as authorized by written permission.
 *                 The copyright and the foregoing restriction extend to reproduction in all media.
 *                 All rights reserved.
 *    @see      ETSI TS 103 478
 */
module LibHttp_Templates {
    
    // LibHttp
    import from LibHttp_TypesAndValues all;
    
    template (value) HeaderLine m_header_line(
                                              in template (value) charstring p_header_name,
                                              in template (value) charstring_list p_header_value
    ) := {
      header_name := p_header_name,
      header_value  := p_header_value
    } // End of template m_header_line
    
    template (value) HttpMessage m_http_request(
                                                in template (value) Request p_request
    ) := {
      request := p_request
    } // End of template m_http_request
    
    template (present) HttpMessage mw_http_request(
                                                   template (present) Request p_request := ?
    ) := {
      request := p_request
    } // End of template mw_http_request
    
    template (value) HttpMessage m_http_response(
                                                 in template (value) Response p_response
    ) := {
      response := p_response
    } // End of template m_http_response
    
    template (present) HttpMessage mw_http_response(
                                                    template (present) Response p_response := ?
    ) := {
      response := p_response
    } // End of template mw_http_response
    
    template (omit) Request m_http_request_get(
                                               in charstring p_uri, 
                                               in template (value) HeaderLines p_headers,
                                               in template (omit) charstring p_body := omit
    ) := {
      method        := "GET",
      uri           := p_uri,
      version_major := c_http_version_major,
      version_minor := c_http_version_minor,
      header        := p_headers,
      body          := p_body
    } // End of template m_http_request_get
    
} // End of module LibHttp_Templates
+59 −0
Original line number Original line Diff line number Diff line
/**
 *    @author   ETSI / STF545
 *    @version  $URL$
 *              $ID:$
 *    @desc     This module provides the types and values used by ITS HTTP based protocols.
 *    @copyright   ETSI Copyright Notification
 *                 No part may be reproduced except as authorized by written permission.
 *                 The copyright and the foregoing restriction extend to reproduction in all media.
 *                 All rights reserved.
 *    @see      ETSI TS 103 478
 */
module LibHttp_TypesAndValues {
    
    const integer c_http_version_major := 1;
    const integer c_http_version_minor := 1;
    
    type record of charstring charstring_list;
    type record HeaderLine {
      charstring        header_name,
      charstring_list   header_value
    } with { 
        variant "FIELDORDER(msb)" 
    }
    
    type record of HeaderLine HeaderLines;
    
    type record Request {
      charstring method,
      charstring uri,
      integer version_major,
      integer version_minor,
      HeaderLines header,
      charstring body optional
    } with { 
        variant "FIELDORDER(msb)" 
    }
    
    type record Response {
      integer version_major,
      integer version_minor,
      integer statuscode,
      charstring statustext,
      HeaderLines header,
      charstring body optional
    } with { 
        variant "FIELDORDER(msb)" 
    }
    
    type union HttpMessage {
      Response response,
      Request request
    } with { 
        variant "FIELDORDER(msb)" 
    }
    
} with {
        variant ""
        encode "HttcpCodec"
} // End of module LibHttp_TypesAndValues