Merge lp:~hipl-core/hipl/mobility-fixes into lp:hipl

Proposed by René Hummen
Status: Merged
Merged at revision: 5173
Proposed branch: lp:~hipl-core/hipl/mobility-fixes
Merge into: lp:hipl
Diff against target: 1095 lines (+338/-360)
21 files modified
firewall/conntrack.c (+1/-0)
hipd/esp_prot_hipd_msg.c (+1/-0)
hipd/esp_prot_light_update.c (+1/-0)
hipd/hadb.h (+0/-2)
hipd/hadb_legacy.h (+0/-12)
hipd/hipd.c (+0/-1)
hipd/hipd.h (+0/-2)
hipd/init.c (+1/-0)
hipd/input.c (+1/-0)
lib/core/builder.c (+6/-177)
lib/core/builder.h (+6/-10)
lib/core/debug.c (+1/-51)
lib/core/debug.h (+0/-6)
lib/core/protodefs.h (+0/-52)
lib/core/state.h (+0/-35)
modules/update/Makefile.am (+1/-0)
modules/update/hipd/update.c (+94/-12)
modules/update/hipd/update.h (+60/-0)
modules/update/hipd/update_builder.c (+111/-0)
modules/update/hipd/update_builder.h (+49/-0)
modules/update/hipd/update_legacy.c (+5/-0)
To merge this branch: bzr merge lp:~hipl-core/hipl/mobility-fixes
Reviewer Review Type Date Requested Status
Diego Biurrun Needs Fixing
Review via email: mp+41490@code.launchpad.net

Description of the change

This branch aims at further encapsulating mobility functionality in the update module. To this end, dead code was removed or has been moved where possible.

To post a comment you must log in.
Revision history for this message
Diego Biurrun (diego-biurrun) wrote :
Download full text (6.0 KiB)

On Mon, Nov 22, 2010 at 05:21:54PM +0000, René Hummen wrote:
> René Hummen has proposed merging lp:~hipl-core/hipl/mobility-fixes into lp:hipl.
>
> Requested reviews:
> HIPL core team (hipl-core)

Looks mostly good, I noticed some issues below.

 review needs-fixing

> --- modules/update/Makefile.am 2010-03-30 08:44:33 +0000
> +++ modules/update/Makefile.am 2010-11-22 17:21:23 +0000
> @@ -1,6 +1,7 @@
>
> modules_update_hipd_libhipupdate_la_SOURCES = modules/update/hipd/update.c \
> - modules/update/hipd/update_legacy.c
> + modules/update/hipd/update_legacy.c \
> + modules/update/hipd/update_builder.c

alphabetical order please

> --- modules/update/hipd/update.c 2010-11-12 16:42:54 +0000
> +++ modules/update/hipd/update.c 2010-11-22 17:21:23 +0000
> @@ -616,6 +622,88 @@
>
> /**
> + * Retreive a @c LOCATOR ADDRESS ITEM@c from a list.

The second @c looks misplaced, I don't think you wanted to markup "from".
I suggest you run 'make doxygen' and see if this really produces what
you intended to express.

> +static union hip_locator_info_addr *hip_get_locator_item(void *item_list, int idx)

needlessly long line

> +{
> + int i = 0;
> + struct hip_locator_info_addr_item *temp;
> + char *result;
> + result = (char *) item_list;

pointless void* cast

> + for (i = 0; i <= idx - 1; i++) {
> + temp = (struct hip_locator_info_addr_item *) result;
> + if (temp->locator_type == HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI ||
> + temp->locator_type == HIP_LOCATOR_LOCATOR_TYPE_IPV6) {
> + result += sizeof(struct hip_locator_info_addr_item);
> + } else {
> + result += sizeof(struct hip_locator_info_addr_item2);
> + }

The temp assignment looks useless, does the following (untested) work?

for (i = 0; i <= idx - 1; i++) {
    if (result->locator_type == HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI ||
        result->locator_type == HIP_LOCATOR_LOCATOR_TYPE_IPV6) {
        result += sizeof(struct hip_locator_info_addr_item);
    } else {
        result += sizeof(struct hip_locator_info_addr_item2);
    }
}

> +/**
> + * Retrieve the amount the locators inside a LOCATOR parameter.

Doh?

> + * Type 1 and 2 parameters are supported.
> + *
> + * @param locator a LOCATOR parameter
> + * @return the amount of locators

s/amount/number/

> +int hip_get_locator_addr_item_count(const struct hip_locator *locator)
> +{
> + const char *address_pointer = (const char *) (locator + 1);
> + int amount = 0;
> + uint8_t type;
> +
> + while (address_pointer <
> + ((const char *) locator) + hip_get_param_contents_len(locator)) {
> + type = ((const struct hip_locator_info_addr_item *)
> + address_pointer)->locator_type;

address_pointer is never really used as char*, so it should possibly be
one of the types it is cast to. Also I wonder why you use const for a
variable that is assigned to later in the function.

> + if (type == HIP_LOCATOR_LOCATOR_TYPE_UDP) {
> + address_pointer += sizeof(struct hip_locator_inf...

Read more...

review: Needs Fixing
lp:~hipl-core/hipl/mobility-fixes updated
5183. By René Hummen

fixed alignment, spelling and incorporated feedback from mailinglist

Revision history for this message
René Hummen (rene-hummen) wrote :

I addressed the comments in rev 5182. If there are no further comments, I will commit the changes to trunk.

Revision history for this message
Diego Biurrun (diego-biurrun) wrote :

On Tue, Nov 23, 2010 at 02:44:28PM +0000, René Hummen wrote:
> I addressed the comments in rev 5182. If there are no further comments, I will commit the changes to trunk.

You left 10 minutes for "further comments".

If you wish to commit right away, commit right away, but if you wish to
hear further comments, leave a sensible timeframe for comments to
arrive...

Diego

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'firewall/conntrack.c'
2--- firewall/conntrack.c 2010-10-27 11:27:48 +0000
3+++ firewall/conntrack.c 2010-11-23 14:43:16 +0000
4@@ -59,6 +59,7 @@
5 #include "lib/core/prefix.h"
6 #include "lib/core/protodefs.h"
7 #include "lib/tool/pk.h"
8+#include "modules/update/hipd/update.h"
9 #include "common_types.h"
10 #include "dlist.h"
11 #include "esp_prot_conntrack.h"
12
13=== modified file 'hipd/esp_prot_hipd_msg.c'
14--- hipd/esp_prot_hipd_msg.c 2010-10-15 15:29:14 +0000
15+++ hipd/esp_prot_hipd_msg.c 2010-11-23 14:43:16 +0000
16@@ -45,6 +45,7 @@
17 #include "lib/core/ife.h"
18 #include "lib/core/protodefs.h"
19 #include "lib/tool/xfrmapi.h"
20+#include "modules/update/hipd/update_builder.h"
21 #include "cookie.h"
22 #include "esp_prot_anchordb.h"
23 #include "esp_prot_light_update.h"
24
25=== modified file 'hipd/esp_prot_light_update.c'
26--- hipd/esp_prot_light_update.c 2010-10-15 15:29:14 +0000
27+++ hipd/esp_prot_light_update.c 2010-11-23 14:43:16 +0000
28@@ -43,6 +43,7 @@
29 #include "lib/core/ife.h"
30 #include "lib/core/protodefs.h"
31 #include "lib/tool/xfrmapi.h"
32+#include "modules/update/hipd/update_builder.h"
33 #include "esp_prot_anchordb.h"
34 #include "esp_prot_hipd_msg.h"
35 #include "hipd.h"
36
37=== modified file 'hipd/hadb.h'
38--- hipd/hadb.h 2010-10-15 15:29:14 +0000
39+++ hipd/hadb.h 2010-11-23 14:43:16 +0000
40@@ -42,8 +42,6 @@
41 /* For switch userspace / kernel IPsec */
42 extern int hip_use_userspace_ipsec;
43
44-extern hip_xmit_func_set_t nat_xmit_func_set;
45-
46 extern HIP_HASHTABLE *hadb_hit;
47
48 void hip_hadb_hold_entry(void *entry);
49
50=== modified file 'hipd/hadb_legacy.h'
51--- hipd/hadb_legacy.h 2010-10-15 15:29:14 +0000
52+++ hipd/hadb_legacy.h 2010-11-23 14:43:16 +0000
53@@ -37,18 +37,6 @@
54 const struct in6_addr *addr,
55 uint32_t *lifetime,
56 struct timeval *modified_time);
57-void hip_update_handle_ack_old(hip_ha_t *entry,
58- struct hip_ack *ack,
59- int have_esp_info);
60-//add by santtu
61-int hip_hadb_add_udp_addr_old(hip_ha_t *entry,
62- struct in6_addr *addr,
63- int is_bex_address,
64- uint32_t lifetime,
65- int is_preferred_addr,
66- uint16_t port,
67- uint32_t priority,
68- uint8_t kind);
69
70 void hip_hadb_delete_peer_addrlist_one_old(hip_ha_t *ha, struct in6_addr *addr);
71
72
73=== modified file 'hipd/hipd.c'
74--- hipd/hipd.c 2010-10-15 15:29:14 +0000
75+++ hipd/hipd.c 2010-11-23 14:43:16 +0000
76@@ -159,7 +159,6 @@
77
78 int hip_shotgun_status = HIP_MSG_SHOTGUN_OFF;
79
80-int hip_trigger_update_on_heart_beat_failure = 1;
81 int hip_wait_addr_changes_to_stabilize = 1;
82
83 /**
84
85=== modified file 'hipd/hipd.h'
86--- hipd/hipd.h 2010-10-15 15:29:14 +0000
87+++ hipd/hipd.h 2010-11-23 14:43:16 +0000
88@@ -112,8 +112,6 @@
89 extern int esp_prot_num_transforms;
90 extern long esp_prot_num_parallel_hchains;
91
92-extern int hip_trigger_update_on_heart_beat_failure;
93-
94 extern int hip_locator_status;
95 extern int hip_transform_order;
96
97
98=== modified file 'hipd/init.c'
99--- hipd/init.c 2010-10-15 15:29:14 +0000
100+++ hipd/init.c 2010-11-23 14:43:16 +0000
101@@ -708,6 +708,7 @@
102 lmod_register_packet_type(HIP_CLOSE_ACK, "HIP_CLOSE_ACK");
103 lmod_register_packet_type(HIP_PSIG, "HIP_PSIG");
104 lmod_register_packet_type(HIP_TRIG, "HIP_TRIG");
105+ lmod_register_packet_type(HIP_UPDATE, "HIP_UPDATE");
106 lmod_register_packet_type(HIP_LUPDATE, "HIP_LUPDATE");
107 lmod_register_packet_type(HIP_DATA, "HIP_DATA");
108 lmod_register_packet_type(HIP_PAYLOAD, "HIP_PAYLOAD");
109
110=== modified file 'hipd/input.c'
111--- hipd/input.c 2010-10-22 10:41:25 +0000
112+++ hipd/input.c 2010-11-23 14:43:16 +0000
113@@ -69,6 +69,7 @@
114 #include "lib/core/state.h"
115 #include "lib/core/transform.h"
116 #include "lib/tool/xfrmapi.h"
117+#include "modules/update/hipd/update.h"
118 #include "config.h"
119 #include "cookie.h"
120 #include "dh.h"
121
122=== modified file 'lib/core/builder.c'
123--- lib/core/builder.c 2010-11-15 12:40:48 +0000
124+++ lib/core/builder.c 2010-11-23 14:43:16 +0000
125@@ -393,7 +393,7 @@
126 * @param tlv_generic pointer to the parameter
127 * @param type type of the parameter (in host byte order)
128 */
129-static void hip_set_param_type(struct hip_tlv_common *tlv_generic, hip_tlv_type_t type)
130+void hip_set_param_type(struct hip_tlv_common *tlv_generic, hip_tlv_type_t type)
131 {
132 tlv_generic->type = htons(type);
133 }
134@@ -468,17 +468,6 @@
135 }
136
137 /**
138- * Retrieve a pointer to the first locator in a LOCATOR parameter
139- *
140- * @param locator a pointer a LOCATOR parameter
141- * @return a pointer to the first locator in the LOCATOR parameter
142- */
143-struct hip_locator_info_addr_item *hip_get_locator_first_addr_item(struct hip_locator *locator)
144-{
145- return (struct hip_locator_info_addr_item *) (locator + 1);
146-}
147-
148-/**
149 * Translate a service life time from seconds to a 8-bit integer value. The
150 * lifetime value in seconds is translated to a 8-bit integer value using
151 * following formula: <code>lifetime = (8 * (log(seconds) / log(2)))
152@@ -1069,9 +1058,9 @@
153 * @param contents_size size of the contents after the TLV header
154 * (in host byte order)
155 */
156-static void hip_calc_generic_param_len(struct hip_tlv_common *tlv_common,
157- hip_tlv_len_t tlv_size,
158- hip_tlv_len_t contents_size)
159+void hip_calc_generic_param_len(struct hip_tlv_common *tlv_common,
160+ hip_tlv_len_t tlv_size,
161+ hip_tlv_len_t contents_size)
162 {
163 hip_set_param_contents_len(tlv_common,
164 tlv_size + contents_size -
165@@ -1089,8 +1078,8 @@
166 * @param contents_size size of the contents after type and length fields
167 * (in host byte order)
168 */
169-static void hip_calc_param_len(struct hip_tlv_common *tlv_common,
170- hip_tlv_len_t contents_size)
171+void hip_calc_param_len(struct hip_tlv_common *tlv_common,
172+ hip_tlv_len_t contents_size)
173 {
174 hip_calc_generic_param_len(tlv_common,
175 sizeof(struct hip_tlv_common),
176@@ -2829,84 +2818,6 @@
177 }
178
179 /**
180- * build a HIP locator parameter
181- *
182- * @param msg the message where the REA will be appended
183- * @param addrs list of addresses
184- * @param addr_count number of addresses
185- * @return 0 on success, otherwise < 0.
186- */
187-int hip_build_param_locator(struct hip_common *msg,
188- struct hip_locator_info_addr_item *addrs,
189- int addr_count)
190-{
191- int err = 0;
192- struct hip_locator *locator_info = NULL;
193- int addrs_len = addr_count * (sizeof(struct hip_locator_info_addr_item));
194-
195- HIP_IFE(!(locator_info = malloc(sizeof(struct hip_locator) + addrs_len)), -1);
196-
197- hip_set_param_type((struct hip_tlv_common *) locator_info, HIP_PARAM_LOCATOR);
198-
199- hip_calc_generic_param_len((struct hip_tlv_common *) locator_info,
200- sizeof(struct hip_locator),
201- addrs_len);
202-
203- memcpy(locator_info + 1, addrs, addrs_len);
204- HIP_IFE(hip_build_param(msg, locator_info), -1);
205-
206-out_err:
207- if (locator_info) {
208- free(locator_info);
209- }
210- return err;
211-}
212-
213-
214-
215-/**
216- * build and append a HIP SEQ parameter to a message
217- *
218- * @param msg the message where the parameter will be appended
219- * @param update_id Update ID
220- * @return 0 on success, otherwise < 0.
221- */
222-int hip_build_param_seq(struct hip_common *msg, uint32_t update_id)
223-{
224- int err = 0;
225- struct hip_seq seq;
226-
227- hip_set_param_type((struct hip_tlv_common *) &seq, HIP_PARAM_SEQ);
228- hip_calc_generic_param_len((struct hip_tlv_common *) &seq,
229- sizeof(struct hip_seq),
230- 0);
231- seq.update_id = htonl(update_id);
232- err = hip_build_param(msg, &seq);
233- return err;
234-}
235-
236-/**
237- * build and append a HIP ACK parameter to a message
238- *
239- * @param msg the message where the parameter will be appended
240- * @param peer_update_id peer Update ID
241- * @return 0 on success, otherwise < 0.
242- */
243-int hip_build_param_ack(struct hip_common *msg, uint32_t peer_update_id)
244-{
245- int err = 0;
246- struct hip_ack ack;
247-
248- hip_set_param_type((struct hip_tlv_common *) &ack, HIP_PARAM_ACK);
249- hip_calc_generic_param_len((struct hip_tlv_common *) &ack,
250- sizeof(struct hip_ack),
251- 0);
252- ack.peer_update_id = htonl(peer_update_id);
253- err = hip_build_param(msg, &ack);
254- return err;
255-}
256-
257-/**
258 * build and append a ESP PROT transform parameter
259 *
260 * @param msg the message where the parameter will be appended
261@@ -3954,88 +3865,6 @@
262 }
263
264 /**
265- * Retrieve the amount the locators inside a LOCATOR parameter.
266- * Type 1 and 2 parameters are supported.
267- *
268- * @param locator a LOCATOR parameter
269- * @return the amount of locators
270- */
271-int hip_get_locator_addr_item_count(const struct hip_locator *locator)
272-{
273- const char *address_pointer = (const char *) (locator + 1);
274- int amount = 0;
275- uint8_t type;
276-
277- while (address_pointer <
278- ((const char *) locator) + hip_get_param_contents_len(locator)) {
279- type = ((const struct hip_locator_info_addr_item *)
280- address_pointer)->locator_type;
281-
282- if (type == HIP_LOCATOR_LOCATOR_TYPE_UDP) {
283- address_pointer += sizeof(struct hip_locator_info_addr_item2);
284- amount += 1;
285- } else if (type == HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI) {
286- address_pointer += sizeof(struct hip_locator_info_addr_item);
287- amount += 1;
288- } else if (type == HIP_LOCATOR_LOCATOR_TYPE_IPV6) {
289- address_pointer += sizeof(struct hip_locator_info_addr_item);
290- amount += 1;
291- } else {
292- address_pointer += sizeof(struct hip_locator_info_addr_item);
293- }
294- }
295- return amount;
296-}
297-
298-/**
299- * Retreive a @c LOCATOR ADDRESS ITEM@c from a list.
300- *
301- * @param item_list a pointer to the first item in the list
302- * @param idx the index of the item in the list
303- * @return the locator addres item
304- */
305-union hip_locator_info_addr *hip_get_locator_item(void *item_list, int idx)
306-{
307- int i = 0;
308- struct hip_locator_info_addr_item *temp;
309- char *result;
310- result = (char *) item_list;
311-
312-
313- for (i = 0; i <= idx - 1; i++) {
314- temp = (struct hip_locator_info_addr_item *) result;
315- if (temp->locator_type == HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI ||
316- temp->locator_type == HIP_LOCATOR_LOCATOR_TYPE_IPV6) {
317- result += sizeof(struct hip_locator_info_addr_item);
318- } else {
319- result += sizeof(struct hip_locator_info_addr_item2);
320- }
321- }
322- return (union hip_locator_info_addr *) result;
323-}
324-
325-/**
326- * retrieve a IP address from a locator item structure
327- *
328- * @param item a pointer to the item
329- * @return a pointer to the IP address
330- */
331-struct in6_addr *hip_get_locator_item_address(void *item)
332-{
333- struct hip_locator_info_addr_item *temp;
334-
335-
336- temp = (struct hip_locator_info_addr_item *) item;
337- if (temp->locator_type == HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI) {
338- return &temp->address;
339- } else if (temp->locator_type == HIP_LOCATOR_LOCATOR_TYPE_IPV6) {
340- return &temp->address;
341- } else {
342- return &((struct hip_locator_info_addr_item2 *) temp)->address;
343- }
344-}
345-
346-/**
347 * Build a @c RELAY_TO parameter to the HIP packet @c msg.
348 *
349 * @param msg a pointer to a HIP packet common header
350
351=== modified file 'lib/core/builder.h'
352--- lib/core/builder.h 2010-10-15 15:29:14 +0000
353+++ lib/core/builder.h 2010-11-23 14:43:16 +0000
354@@ -68,7 +68,6 @@
355 const struct in6_addr *,
356 const struct in6_addr *);
357 int hip_host_id_hits(hip_ha_t *entry, struct hip_common *msg);
358-int hip_build_param_ack(struct hip_common *, uint32_t);
359 int hip_build_param_contents(struct hip_common *,
360 const void *,
361 hip_tlv_type_t,
362@@ -115,9 +114,6 @@
363 uint32_t,
364 uint16_t,
365 struct hip_crypto_key *);
366-int hip_build_param_locator(struct hip_common *,
367- struct hip_locator_info_addr_item *,
368- int);
369 int hip_build_param_cert(struct hip_common *,
370 uint8_t,
371 uint8_t,
372@@ -139,7 +135,6 @@
373
374 int hip_build_param_r1_counter(struct hip_common *, uint64_t);
375
376-int hip_build_param_seq(struct hip_common *, uint32_t);
377 int hip_build_param_signature2_contents(struct hip_common *,
378 const void *,
379 hip_tlv_len_t,
380@@ -190,13 +185,9 @@
381 struct hip_dh_public_value
382 *hip_dh_select_key(struct hip_diffie_hellman *);
383 uint8_t hip_get_host_id_algo(const struct hip_host_id *);
384-int hip_get_locator_addr_item_count(const struct hip_locator *);
385-union hip_locator_info_addr *hip_get_locator_item(void *item_list, int index);
386 int hip_get_lifetime_value(time_t seconds, uint8_t *lifetime);
387 int hip_get_lifetime_seconds(uint8_t lifetime, time_t *seconds);
388 int hip_check_network_msg_len(const struct hip_common *msg);
389-struct hip_locator_info_addr_item
390- *hip_get_locator_first_addr_item(struct hip_locator *);
391 hip_hdr_err_t hip_get_msg_err(const struct hip_common *);
392 uint16_t hip_get_msg_total_len(const struct hip_common *);
393 hip_hdr_type_t hip_get_msg_type(const struct hip_common *);
394@@ -216,6 +207,12 @@
395 hip_tlv_len_t hip_get_param_total_len(const void *);
396 hip_transform_suite_t hip_get_param_transform_suite_id(const void *);
397 hip_tlv_type_t hip_get_param_type(const void *);
398+void hip_set_param_type(struct hip_tlv_common *tlv_generic, hip_tlv_type_t type);
399+void hip_calc_generic_param_len(struct hip_tlv_common *tlv_common,
400+ hip_tlv_len_t tlv_size,
401+ hip_tlv_len_t contents_size);
402+void hip_calc_param_len(struct hip_tlv_common *tlv_common,
403+ hip_tlv_len_t contents_size);
404 uint16_t hip_get_msg_checksum(struct hip_common *msg);
405 const char *hip_message_type_name(const uint8_t);
406 struct hip_common *hip_msg_alloc(void);
407@@ -284,7 +281,6 @@
408 int hip_build_param_nat_port(hip_common_t *msg,
409 const in_port_t port,
410 hip_tlv_type_t hipparam);
411-struct in6_addr *hip_get_locator_item_address(void *item);
412 int hip_build_digest(const int type, const void *in, int in_len, void *out);
413
414 int hip_build_param_hmac(struct hip_common *msg,
415
416=== modified file 'lib/core/debug.c'
417--- lib/core/debug.c 2010-10-18 17:44:31 +0000
418+++ lib/core/debug.c 2010-11-23 14:43:16 +0000
419@@ -83,6 +83,7 @@
420 #include "lib/core/list.h"
421 #include "lib/core/prefix.h"
422 #include "lib/tool/lutil.h"
423+#include "modules/update/hipd/update.h"
424 #include "builder.h"
425 #include "ife.h"
426 #include "state.h"
427@@ -813,54 +814,3 @@
428 HIP_DEBUG_HIT("Peer address", &addr->address);
429 }
430 }
431-
432-/**
433- * Print a locator.
434- * @param file
435- * @param debug_level
436- * @param line
437- * @param function
438- * @param str string to be printed before the HIT
439- * @param locator the locator to be printed
440- */
441-void hip_print_locator(UNUSED int debug_level, UNUSED const char *file,
442- UNUSED int line, UNUSED const char *function,
443- DBG const char *str, struct hip_locator *locator)
444-{
445-/* XXTRASHXX Totally useless does anything but what it is supposed to do -SAMU */
446-
447- int n_addrs = 0, i = 0;
448- struct hip_locator_info_addr_item *first_address_item = NULL,
449- *locator_address_item = NULL;
450- struct hip_locator_info_addr_item2 *locator_address_item2 = NULL;
451- /* locator = hip_get_param((struct hip_common *)in_msg,
452- * HIP_PARAM_LOCATOR);*/
453- if (locator) {
454- HIP_DEBUG("%s: \n", str);
455-
456- n_addrs = hip_get_locator_addr_item_count(locator);
457- HIP_DEBUG("there are %d locator items \n", n_addrs);
458- first_address_item = hip_get_locator_first_addr_item(locator);
459-
460- for (i = 0; i < n_addrs; i++) {
461- locator_address_item = (struct hip_locator_info_addr_item *)
462- hip_get_locator_item(first_address_item, i);
463- HIP_DEBUG("locator items index %d, type is %d \n", i,
464- locator_address_item->locator_type );
465- if (locator_address_item->locator_type == HIP_LOCATOR_LOCATOR_TYPE_IPV6) {
466- HIP_INFO_HIT("locator",
467- (struct in6_addr *) &locator_address_item->address);
468- }
469- if (locator_address_item->locator_type == HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI) {
470- HIP_INFO_HIT("LOCATOR from ESP SPI(type 1)",
471- (struct in6_addr *) &locator_address_item->address);
472- }
473- if (locator_address_item->locator_type == HIP_LOCATOR_LOCATOR_TYPE_UDP) {
474- locator_address_item2 = (struct hip_locator_info_addr_item2 *) locator_address_item;
475- HIP_INFO_HIT("LOCATOR from UDP",
476- (struct in6_addr *) &locator_address_item2->address);
477- HIP_DEBUG("LOCATOR port for UDP: %d\n", ntohs(locator_address_item2->port));
478- }
479- }
480- }
481-}
482
483=== modified file 'lib/core/debug.h'
484--- lib/core/debug.h 2010-11-12 15:50:17 +0000
485+++ lib/core/debug.h 2010-11-23 14:43:16 +0000
486@@ -406,12 +406,6 @@
487 void hip_print_locator_addresses(const struct hip_common *);
488 void hip_print_peer_addresses_to_be_added(hip_ha_t *);
489 void hip_print_peer_addresses(hip_ha_t *);
490-void hip_print_locator(int debug_level,
491- const char *file,
492- int line,
493- const char *function,
494- const char *str,
495- struct hip_locator *locator);
496
497 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
498
499
500=== modified file 'lib/core/protodefs.h'
501--- lib/core/protodefs.h 2010-10-20 03:38:26 +0000
502+++ lib/core/protodefs.h 2010-11-23 14:43:16 +0000
503@@ -576,12 +576,6 @@
504 typedef struct in6_addr hip_hit_t;
505 typedef struct in_addr hip_lsi_t;
506 typedef struct hip_hadb_state hip_ha_t;
507-typedef struct hip_hadb_rcv_func_set hip_rcv_func_set_t;
508-typedef struct hip_hadb_handle_func_set hip_handle_func_set_t;
509-typedef struct hip_hadb_update_func_set hip_update_func_set_t;
510-typedef struct hip_hadb_misc_func_set hip_misc_func_set_t;
511-typedef struct hip_hadb_xmit_func_set hip_xmit_func_set_t;
512-typedef struct hip_ipsec_func_set hip_ipsec_func_set_t;
513 typedef struct hip_common hip_common_t;
514
515 struct hip_crypto_key {
516@@ -688,46 +682,6 @@
517 uint16_t caseid;
518 } __attribute__ ((packed));
519
520-/**
521- * Fixed start of this struct must match to struct hip_peer_addr_list_item
522- * for the part of address item. It is used in hip_update_locator_match().
523- * @todo Maybe fix this in some better way?
524- */
525-struct hip_locator_info_addr_item {
526- uint8_t traffic_type;
527- uint8_t locator_type;
528- uint8_t locator_length;
529- uint8_t reserved; /**< last bit is P (prefered) */
530- uint32_t lifetime;
531- struct in6_addr address;
532-} __attribute__ ((packed));
533-//add by santtu
534-/**
535- * it is the type 2 locater for UDP or other transport protocol later.
536- */
537-struct hip_locator_info_addr_item2 {
538- uint8_t traffic_type;
539- uint8_t locator_type;
540- uint8_t locator_length;
541- uint8_t reserved; /* last bit is P (prefered) */
542- uint32_t lifetime;
543- uint16_t port;
544- uint8_t transport_protocol;
545- uint8_t kind;
546- uint32_t priority;
547- uint32_t spi;
548- struct in6_addr address;
549-} __attribute__ ((packed));
550-
551-
552-/**
553- * it is a union of both type1 and type2 locator.
554- */
555-union hip_locator_info_addr {
556- struct hip_locator_info_addr_item type1;
557- struct hip_locator_info_addr_item2 type2;
558-} __attribute__ ((packed));
559-//end add
560 /** Structure describing an endpoint. This structure is used by the resolver in
561 * the userspace, so it is not length-padded like HIP parameters. All of the
562 * members are in network byte order.
563@@ -938,12 +892,6 @@
564 uint8_t data[0]; /**< A pointer to the notification data */
565 } __attribute__ ((packed));
566
567-struct hip_locator {
568- hip_tlv_type_t type;
569- hip_tlv_len_t length;
570- /* fixed part ends */
571-} __attribute__ ((packed));
572-
573 struct hip_hmac {
574 hip_tlv_type_t type;
575 hip_tlv_len_t length;
576
577=== modified file 'lib/core/state.h'
578--- lib/core/state.h 2010-11-12 16:42:54 +0000
579+++ lib/core/state.h 2010-11-23 14:43:16 +0000
580@@ -80,26 +80,10 @@
581 /* #define PEER_ADDR_STATE_UNVERIFIED 1 */
582 #define PEER_ADDR_STATE_ACTIVE 2
583
584-#define HIP_LOCATOR_TRAFFIC_TYPE_DUAL 0
585-#define HIP_LOCATOR_TRAFFIC_TYPE_SIGNAL 1
586-
587-#define HIP_LOCATOR_LOCATOR_TYPE_IPV6 0
588-#define HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI 1
589-//NAT branch
590-#define HIP_LOCATOR_LOCATOR_TYPE_UDP 2
591-
592-/* #define HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI_PRIORITY 126 */
593-/* #define HIP_LOCATOR_LOCATOR_TYPE_REFLEXIVE_PRIORITY 120 */
594 /** for the triple nat mode*/
595 #define HIP_NAT_MODE_NONE 0
596 #define HIP_NAT_MODE_PLAIN_UDP 1
597
598-#define HIP_UPDATE_LOCATOR 0
599-#define HIP_UPDATE_ECHO_REQUEST 1
600-#define HIP_UPDATE_ECHO_RESPONSE 2
601-#define HIP_UPDATE_ESP_ANCHOR 3
602-#define HIP_UPDATE_ESP_ANCHOR_ACK 4
603-
604 #define HIP_SPI_DIRECTION_OUT 1
605 #define HIP_SPI_DIRECTION_IN 2
606
607@@ -142,8 +126,6 @@
608 uint32_t lifetime;
609 struct timeval modified_time; /* time when this address was
610 * added or updated */
611- uint32_t seq_update_id; /* the Update ID in SEQ parameter
612- * this address is related to */
613 uint8_t echo_data[4]; /* data put into the ECHO_REQUEST parameter */
614 //NAT branch
615 uint8_t transport_protocol; /*value 1 for UDP*/
616@@ -162,34 +144,17 @@
617 /* ifindex if the netdev to which this is related to */
618 int ifindex;
619 unsigned long timestamp; /* when SA was created */
620- int updating; /* UPDATE is in progress */
621 uint32_t esp_info_spi_out; /* UPDATE, the stored outbound
622 * SPI related to the inbound
623 * SPI we sent in reply (useless?)*/
624 uint16_t keymat_index; /* advertised keymat index */
625- int update_state_flags; /* 0x1=received ack for
626- * sent SEQ, 0x2=received
627- * peer's ESP_INFO,
628- * both=0x3=can move back
629- * to established */
630 /* the Update ID in SEQ parameter these SPI are related to */
631- uint32_t seq_update_id;
632- /* the corresponding esp_info of peer */
633 struct hip_esp_info stored_received_esp_info;
634- /* our addresses this SPI is related to, reuse struct to ease coding */
635- struct hip_locator_info_addr_item *addresses;
636- int addresses_n; /* number of addresses */
637 };
638
639 struct hip_spi_out_item {
640 uint32_t spi;
641 uint32_t new_spi; /* spi is changed to this when rekeying */
642-
643- /* USELESS, IF SEQ ID WILL BE RELATED TO ADDRESS ITEMS,
644- * NOT OUTBOUND SPIS */
645- /* the Update ID in SEQ parameter these SPI are related to */
646- uint32_t seq_update_id;
647-
648 HIP_HASHTABLE * peer_addr_list; /* Peer's IPv6 addresses */
649 struct in6_addr preferred_address;
650 };
651
652=== modified file 'modules/update/Makefile.am'
653--- modules/update/Makefile.am 2010-03-30 08:44:33 +0000
654+++ modules/update/Makefile.am 2010-11-23 14:43:16 +0000
655@@ -1,6 +1,7 @@
656 lib_LTLIBRARIES += modules/update/hipd/libhipupdate.la
657
658 modules_update_hipd_libhipupdate_la_SOURCES = modules/update/hipd/update.c \
659+ modules/update/hipd/update_builder.c \
660 modules/update/hipd/update_legacy.c
661
662 hipd_hipd_LDADD += modules/update/hipd/libhipupdate.la
663
664=== modified file 'modules/update/hipd/update.c'
665--- modules/update/hipd/update.c 2010-11-22 18:30:04 +0000
666+++ modules/update/hipd/update.c 2010-11-23 14:43:16 +0000
667@@ -51,7 +51,6 @@
668 #include "hipd/pisa.h"
669 #include "hipd/pkt_handling.h"
670 #include "hipd/user.h"
671-#include "lib/core/builder.h"
672 #include "lib/core/common.h"
673 #include "lib/core/crypto.h"
674 #include "lib/core/debug.h"
675@@ -64,6 +63,7 @@
676 #include "lib/core/protodefs.h"
677 #include "lib/core/solve.h"
678 #include "lib/core/modularization.h"
679+#include "update_builder.h"
680 #include "update_legacy.h"
681 #include "update.h"
682
683@@ -72,11 +72,6 @@
684 @todo Remove this kludge. */
685 int update_state;
686
687- /** Update function set.
688- @note Do not modify this value directly. Use
689- hip_hadb_set_handle_function_set() instead. */
690- hip_update_func_set_t *hadb_update_func;
691-
692 /** This "linked list" includes the locators we recieved in the initial
693 * UPDATE packet. Locators are stored as "struct in6_addr *"s.
694 *
695@@ -98,6 +93,17 @@
696 static const int update_id_window_size = 50;
697
698 /**
699+ * Retrieve a pointer to the first locator in a LOCATOR parameter
700+ *
701+ * @param locator a pointer a LOCATOR parameter
702+ * @return a pointer to the first locator in the LOCATOR parameter
703+ */
704+static struct hip_locator_info_addr_item *hip_get_locator_first_addr_item(struct hip_locator *locator)
705+{
706+ return (struct hip_locator_info_addr_item *) (locator + 1);
707+}
708+
709+/**
710 * build locators in an UPDATE message
711 *
712 * @param locator_msg the message where the LOCATOR should be appended
713@@ -618,6 +624,88 @@
714 }
715
716 /**
717+ * Retrieve a locator address item from a list.
718+ *
719+ * @param item_list a pointer to the first item in the list
720+ * @param idx the index of the item in the list
721+ * @return the locator addres item
722+ */
723+static union hip_locator_info_addr *hip_get_locator_item(void *item_list,
724+ int idx)
725+{
726+ int i = 0;
727+ struct hip_locator_info_addr_item *temp;
728+ char *result;
729+ result = item_list;
730+
731+
732+ for (i = 0; i <= idx - 1; i++) {
733+ temp = (struct hip_locator_info_addr_item *) result;
734+ if (temp->locator_type == HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI ||
735+ temp->locator_type == HIP_LOCATOR_LOCATOR_TYPE_IPV6) {
736+ result += sizeof(struct hip_locator_info_addr_item);
737+ } else {
738+ result += sizeof(struct hip_locator_info_addr_item2);
739+ }
740+ }
741+ return (union hip_locator_info_addr *) result;
742+}
743+
744+/**
745+ * retrieve a IP address from a locator item structure
746+ *
747+ * @param item a pointer to the item
748+ * @return a pointer to the IP address
749+ */
750+static struct in6_addr *hip_get_locator_item_address(void *item)
751+{
752+ struct hip_locator_info_addr_item *temp;
753+
754+
755+ temp = item;
756+ if (temp->locator_type == HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI) {
757+ return &temp->address;
758+ } else if (temp->locator_type == HIP_LOCATOR_LOCATOR_TYPE_IPV6) {
759+ return &temp->address;
760+ } else {
761+ return &((struct hip_locator_info_addr_item2 *) temp)->address;
762+ }
763+}
764+
765+/**
766+ * Retrieve the number of locators inside a LOCATOR parameter.
767+ * Type 1 and 2 parameters are supported.
768+ *
769+ * @param locator a LOCATOR parameter
770+ * @return the number of locators
771+ */
772+int hip_get_locator_addr_item_count(const struct hip_locator *locator)
773+{
774+ const char *address_pointer = (const char *) (locator + 1);
775+ int loc_count = 0;
776+ uint8_t type;
777+
778+ while (address_pointer <
779+ ((const char *) locator) + hip_get_param_contents_len(locator)) {
780+ type = ((const struct hip_locator_info_addr_item *)
781+ address_pointer)->locator_type;
782+
783+ if (type == HIP_LOCATOR_LOCATOR_TYPE_UDP) {
784+ address_pointer += sizeof(struct hip_locator_info_addr_item2);
785+ loc_count += 1;
786+ } else if (type == HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI
787+ || type == HIP_LOCATOR_LOCATOR_TYPE_IPV6) {
788+
789+ address_pointer += sizeof(struct hip_locator_info_addr_item);
790+ loc_count += 1;
791+ } else {
792+ address_pointer += sizeof(struct hip_locator_info_addr_item);
793+ }
794+ }
795+ return loc_count;
796+}
797+
798+/**
799 * process a LOCATOR paramter
800 *
801 * @param ha the related host association
802@@ -640,7 +728,6 @@
803 HIP_IFEL(!locator, -1, "locator is NULL");
804
805 locator_addr_count = hip_get_locator_addr_item_count(locator);
806- HIP_IFEL((locator_addr_count < 0), -1, "Negative address count\n");
807
808 HIP_DEBUG("LOCATOR has %d address(es), loc param len=%d\n",
809 locator_addr_count, hip_get_param_total_len(locator));
810@@ -852,7 +939,6 @@
811 "Error on allocating memory for a update state instance.\n");
812
813 update_state->update_state = 0;
814- update_state->hadb_update_func = NULL;
815 update_state->addresses_to_send_echo_request = hip_linked_list_init();
816 update_state->update_id_out = 0;
817 update_state->update_id_in = 0;
818@@ -996,8 +1082,6 @@
819 ack_peer_update_id = ntohl(ack->peer_update_id);
820 HIP_DEBUG("ACK parameter found with peer Update ID %u.\n",
821 ack_peer_update_id);
822- /*ha->hadb_update_func->hip_update_handle_ack(
823- * ha, ack, has_esp_info);*/
824 if (ack_peer_update_id != hip_update_get_out_id(localstate)) {
825 // Simplified logic of RFC 5201 6.12.2, 1st step:
826 // We drop the packet if the Update ID in the ACK
827@@ -1139,8 +1223,6 @@
828 {
829 int err = 0;
830
831- lmod_register_packet_type(HIP_UPDATE, "HIP_UPDATE");
832-
833 HIP_IFEL(lmod_register_state_init_function(&hip_update_init_state),
834 -1,
835 "Error on registering update state init function.\n");
836
837=== modified file 'modules/update/hipd/update.h'
838--- modules/update/hipd/update.h 2010-11-19 16:10:03 +0000
839+++ modules/update/hipd/update.h 2010-11-23 14:43:16 +0000
840@@ -38,6 +38,66 @@
841
842 #include "lib/core/protodefs.h"
843
844+/* the different mobility message types */
845+#define HIP_UPDATE_LOCATOR 0
846+#define HIP_UPDATE_ECHO_REQUEST 1
847+#define HIP_UPDATE_ECHO_RESPONSE 2
848+#define HIP_UPDATE_ESP_ANCHOR 3
849+#define HIP_UPDATE_ESP_ANCHOR_ACK 4
850+
851+/* locator parameter types */
852+#define HIP_LOCATOR_LOCATOR_TYPE_IPV6 0
853+#define HIP_LOCATOR_LOCATOR_TYPE_ESP_SPI 1
854+#define HIP_LOCATOR_LOCATOR_TYPE_UDP 2
855+
856+
857+struct hip_locator {
858+ hip_tlv_type_t type;
859+ hip_tlv_len_t length;
860+ /* fixed part ends */
861+} __attribute__ ((packed));
862+
863+/**
864+ * Fixed start of this struct must match to struct hip_peer_addr_list_item
865+ * for the part of address item. It is used in hip_update_locator_match().
866+ * @todo Maybe fix this in some better way?
867+ */
868+struct hip_locator_info_addr_item {
869+ uint8_t traffic_type;
870+ uint8_t locator_type;
871+ uint8_t locator_length;
872+ uint8_t reserved; /**< last bit is P (preferred) */
873+ uint32_t lifetime;
874+ struct in6_addr address;
875+} __attribute__ ((packed));
876+
877+/**
878+ * it is the type 2 locater for UDP or other transport protocol later.
879+ */
880+struct hip_locator_info_addr_item2 {
881+ uint8_t traffic_type;
882+ uint8_t locator_type;
883+ uint8_t locator_length;
884+ uint8_t reserved; /* last bit is P (preferred) */
885+ uint32_t lifetime;
886+ uint16_t port;
887+ uint8_t transport_protocol;
888+ uint8_t kind;
889+ uint32_t priority;
890+ uint32_t spi;
891+ struct in6_addr address;
892+} __attribute__ ((packed));
893+
894+/**
895+ * it is a union of both type1 and type2 locator.
896+ */
897+union hip_locator_info_addr {
898+ struct hip_locator_info_addr_item type1;
899+ struct hip_locator_info_addr_item2 type2;
900+} __attribute__ ((packed));
901+
902+int hip_get_locator_addr_item_count(const struct hip_locator *locator);
903+
904 int hip_create_locators(hip_common_t *locator_msg,
905 struct hip_locator_info_addr_item **locators);
906
907
908=== added file 'modules/update/hipd/update_builder.c'
909--- modules/update/hipd/update_builder.c 1970-01-01 00:00:00 +0000
910+++ modules/update/hipd/update_builder.c 2010-11-23 14:43:16 +0000
911@@ -0,0 +1,111 @@
912+/*
913+ * Copyright (c) 2010 Aalto University and RWTH Aachen University.
914+ *
915+ * Permission is hereby granted, free of charge, to any person
916+ * obtaining a copy of this software and associated documentation
917+ * files (the "Software"), to deal in the Software without
918+ * restriction, including without limitation the rights to use,
919+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
920+ * copies of the Software, and to permit persons to whom the
921+ * Software is furnished to do so, subject to the following
922+ * conditions:
923+ *
924+ * The above copyright notice and this permission notice shall be
925+ * included in all copies or substantial portions of the Software.
926+ *
927+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
928+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
929+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
930+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
931+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
932+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
933+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
934+ * OTHER DEALINGS IN THE SOFTWARE.
935+ */
936+
937+/**
938+ * @file
939+ *
940+ * This file facilitates buiding of mobility and multi-homing-specific
941+ * parameters.
942+ *
943+ * @author Rene Hummen
944+ */
945+
946+#include <string.h>
947+
948+#include "lib/core/builder.h"
949+#include "lib/core/ife.h"
950+#include "update_builder.h"
951+
952+
953+/**
954+ * build and append a HIP SEQ parameter to a message
955+ *
956+ * @param msg the message where the parameter will be appended
957+ * @param update_id Update ID
958+ * @return 0 on success, otherwise < 0.
959+ */
960+int hip_build_param_seq(struct hip_common *msg, uint32_t update_id)
961+{
962+ int err = 0;
963+ struct hip_seq seq;
964+
965+ hip_set_param_type((struct hip_tlv_common *) &seq, HIP_PARAM_SEQ);
966+ hip_calc_param_len((struct hip_tlv_common *) &seq,
967+ sizeof(struct hip_seq));
968+ seq.update_id = htonl(update_id);
969+ err = hip_build_param(msg, &seq);
970+ return err;
971+}
972+
973+/**
974+ * build and append a HIP ACK parameter to a message
975+ *
976+ * @param msg the message where the parameter will be appended
977+ * @param peer_update_id peer Update ID
978+ * @return 0 on success, otherwise < 0.
979+ */
980+int hip_build_param_ack(struct hip_common *msg, uint32_t peer_update_id)
981+{
982+ int err = 0;
983+ struct hip_ack ack;
984+
985+ hip_set_param_type((struct hip_tlv_common *) &ack, HIP_PARAM_ACK);
986+ hip_calc_param_len((struct hip_tlv_common *) &ack, sizeof(struct hip_ack));
987+ ack.peer_update_id = htonl(peer_update_id);
988+ err = hip_build_param(msg, &ack);
989+ return err;
990+}
991+
992+/**
993+ * build a HIP locator parameter
994+ *
995+ * @param msg the message where the REA will be appended
996+ * @param addrs list of addresses
997+ * @param addr_count number of addresses
998+ * @return 0 on success, otherwise < 0.
999+ */
1000+int hip_build_param_locator(struct hip_common *msg,
1001+ struct hip_locator_info_addr_item *addrs,
1002+ int addr_count)
1003+{
1004+ int err = 0;
1005+ struct hip_locator *locator_info = NULL;
1006+ int addrs_len = addr_count * sizeof(struct hip_locator_info_addr_item);
1007+
1008+ HIP_IFE(!(locator_info = malloc(sizeof(struct hip_locator) + addrs_len)), -1);
1009+
1010+ hip_set_param_type((struct hip_tlv_common *) locator_info, HIP_PARAM_LOCATOR);
1011+
1012+ hip_calc_generic_param_len((struct hip_tlv_common *) locator_info,
1013+ sizeof(struct hip_locator),
1014+ addrs_len);
1015+
1016+ memcpy(locator_info + 1, addrs, addrs_len);
1017+ HIP_IFE(hip_build_param(msg, locator_info), -1);
1018+
1019+out_err:
1020+ free(locator_info);
1021+ return err;
1022+}
1023
1024=== added file 'modules/update/hipd/update_builder.h'
1025--- modules/update/hipd/update_builder.h 1970-01-01 00:00:00 +0000
1026+++ modules/update/hipd/update_builder.h 2010-11-23 14:43:16 +0000
1027@@ -0,0 +1,49 @@
1028+/*
1029+ * Copyright (c) 2010 Aalto University and RWTH Aachen University.
1030+ *
1031+ * Permission is hereby granted, free of charge, to any person
1032+ * obtaining a copy of this software and associated documentation
1033+ * files (the "Software"), to deal in the Software without
1034+ * restriction, including without limitation the rights to use,
1035+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
1036+ * copies of the Software, and to permit persons to whom the
1037+ * Software is furnished to do so, subject to the following
1038+ * conditions:
1039+ *
1040+ * The above copyright notice and this permission notice shall be
1041+ * included in all copies or substantial portions of the Software.
1042+ *
1043+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
1044+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
1045+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
1046+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
1047+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
1048+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
1049+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
1050+ * OTHER DEALINGS IN THE SOFTWARE.
1051+ */
1052+
1053+/**
1054+ * @file
1055+ *
1056+ * This file facilitates buiding of mobility and multi-homing-specific
1057+ * parameters.
1058+ *
1059+ * @author Rene Hummen
1060+ */
1061+
1062+#ifndef MODULES_UPDATE_HIPD_UPDATE_BUILDER_H
1063+#define MODULES_UPDATE_HIPD_UPDATE_BUILDER_H
1064+
1065+#include <stdint.h>
1066+
1067+#include "lib/core/protodefs.h"
1068+#include "update.h"
1069+
1070+int hip_build_param_seq(struct hip_common *msg, uint32_t update_id);
1071+int hip_build_param_ack(struct hip_common *msg, uint32_t peer_update_id);
1072+int hip_build_param_locator(struct hip_common *msg,
1073+ struct hip_locator_info_addr_item *addrs,
1074+ int addr_count);
1075+
1076+#endif /* MODULES_UPDATE_HIPD_UPDATE_BUILDER_H */
1077
1078=== modified file 'modules/update/hipd/update_legacy.c'
1079--- modules/update/hipd/update_legacy.c 2010-11-22 18:30:04 +0000
1080+++ modules/update/hipd/update_legacy.c 2010-11-23 14:43:16 +0000
1081@@ -45,9 +45,14 @@
1082 #include "lib/core/list.h"
1083 #include "lib/core/prefix.h"
1084 #include "lib/core/protodefs.h"
1085+#include "update_builder.h"
1086 #include "update.h"
1087 #include "update_legacy.h"
1088
1089+
1090+#define HIP_LOCATOR_TRAFFIC_TYPE_DUAL 0
1091+#define HIP_LOCATOR_TRAFFIC_TYPE_SIGNAL 1
1092+
1093 /**
1094 * build a LOCATOR parameter for an UPDATE packet
1095 *

Subscribers

People subscribed via source and target branches

to all changes: