Added setters for IKE major/minor version to ike_header
authorMartin Willi <martin@revosec.ch>
Thu, 11 Nov 2010 15:35:35 +0000 (16:35 +0100)
committerMartin Willi <martin@revosec.ch>
Wed, 5 Jan 2011 15:45:46 +0000 (16:45 +0100)
src/libcharon/encoding/payloads/ike_header.c
src/libcharon/encoding/payloads/ike_header.h

index e5831f4..9c1bbbe 100644 (file)
@@ -251,12 +251,24 @@ METHOD(ike_header_t, get_maj_version, u_int8_t,
        return this->maj_version;
 }
 
+METHOD(ike_header_t, set_maj_version, void,
+       private_ike_header_t *this, u_int8_t major)
+{
+       this->maj_version = major;
+}
+
 METHOD(ike_header_t, get_min_version, u_int8_t,
        private_ike_header_t *this)
 {
        return this->min_version;
 }
 
+METHOD(ike_header_t, set_min_version, void,
+       private_ike_header_t *this, u_int8_t minor)
+{
+       this->min_version = minor;
+}
+
 METHOD(ike_header_t, get_response_flag, bool,
        private_ike_header_t *this)
 {
@@ -340,7 +352,9 @@ ike_header_t *ike_header_create()
                        .get_responder_spi = _get_responder_spi,
                        .set_responder_spi = _set_responder_spi,
                        .get_maj_version = _get_maj_version,
+                       .set_maj_version = _set_maj_version,
                        .get_min_version = _get_min_version,
+                       .set_min_version = _set_min_version,
                        .get_response_flag = _get_response_flag,
                        .set_response_flag = _set_response_flag,
                        .get_version_flag = _get_version_flag,
index e63e8bf..7bb33a5 100644 (file)
@@ -143,6 +143,13 @@ struct ike_header_t {
        u_int8_t (*get_maj_version) (ike_header_t *this);
 
        /**
+        * Set the major version.
+        *
+        * @param major                 major version
+        */
+       void (*set_maj_version) (ike_header_t *this, u_int8_t major);
+
+       /**
         * Get the minor version.
         *
         * @return                              minor version
@@ -150,6 +157,13 @@ struct ike_header_t {
        u_int8_t (*get_min_version) (ike_header_t *this);
 
        /**
+        * Set the minor version.
+        *
+        * @param minor                 minor version
+        */
+       void (*set_min_version) (ike_header_t *this, u_int8_t minor);
+
+       /**
         * Get the response flag.
         *
         * @return                              response flag