This commit is contained in:
parent
c658ca0b31
commit
43d2843829
1 changed files with 161 additions and 136 deletions
|
@ -1,4 +1,4 @@
|
|||
|
||||
/* vim: set sw=4 ts=4 si et: */
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "timestamp.h"
|
||||
|
@ -101,7 +101,7 @@ char * TimeStamp::getRaw(){
|
|||
|
||||
short index_value = htons(_index);
|
||||
if (DEBUG)
|
||||
printf("TimeStamp::raw -- index_value %d -> %d\n", _index, index_value);
|
||||
printf("TimeStamp::raw -- (ABCAST) index_value %d -> %d\n", _index, index_value);
|
||||
|
||||
memcpy(result, &index_value, 2); // on fixe l'index
|
||||
|
||||
|
@ -110,7 +110,7 @@ char * TimeStamp::getRaw(){
|
|||
net_clock_value = htons(host_clock_value);
|
||||
|
||||
if (DEBUG)
|
||||
printf("TimeStamp::raw -- clock_value %d -> %d\n",host_clock_value, net_clock_value);
|
||||
printf("TimeStamp::raw -- (ABCAST) clock_value %d -> %d\n",host_clock_value, net_clock_value);
|
||||
|
||||
memcpy((result + 2),
|
||||
&net_clock_value, 2); // on fixe l'index
|
||||
|
@ -119,6 +119,31 @@ char * TimeStamp::getRaw(){
|
|||
break;
|
||||
case Protocol::TYPE_CBCAST :
|
||||
{
|
||||
result_len = 2; // 2 bytes for site index
|
||||
result_len += 2 * this->size(); // 2 bytes per site-clock value
|
||||
result = new char[result_len];
|
||||
|
||||
short index_value = htons(_index);
|
||||
|
||||
//FIXME: if (DEBUG)
|
||||
printf("TimeStamp::raw -- (CBCAST) index_value %d -> %d\n", _index, index_value);
|
||||
|
||||
memcpy(result, &index_value, 2);
|
||||
|
||||
short host_clock_value, net_clock_value;
|
||||
for (int idx = 0; idx < this->size(); idx++){
|
||||
host_clock_value = (*this)[idx];
|
||||
net_clock_value = htons(host_clock_value);
|
||||
|
||||
//FIXME: if (DEBUG)
|
||||
printf("TimeStamp::raw -- (CBCAST) clock_value %d -> %d\n",
|
||||
host_clock_value,
|
||||
net_clock_value);
|
||||
|
||||
memcpy((result + 2 + idx * 2),
|
||||
&net_clock_value, 2); // on fixe l'index dans le résultat
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -143,7 +168,7 @@ unsigned short TimeStamp::getRawSize(){
|
|||
break;
|
||||
case Protocol::TYPE_CBCAST :
|
||||
{
|
||||
result = 4; // FIXME: plus la taille du vecteur * 2;
|
||||
result = 2 + (2 * this->size()); // FIXME: plus la taille du vecteur * 2;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
|
Loading…
Add table
Reference in a new issue