You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
* @file ats/ats_api2_transport.c
};
+
+/**
+ * Convert ATS properties from host to network byte order.
+ *
+ * @param nbo[OUT] value written
+ * @param hbo value read
+ */
+static void
+properties_hton (struct PropertiesNBO *nbo,
+ const struct GNUNET_ATS_Properties *hbo)
+{
+ nbo->delay = GNUNET_TIME_relative_hton (hbo->delay);
+ nbo->goodput_out = htonl (hbo->goodput_out);
+ nbo->goodput_in = htonl (hbo->goodput_in);
+ nbo->utilization_out = htonl (hbo->utilization_out);
+ nbo->utilization_in = htonl (hbo->utilization_in);
+ nbo->distance = htonl (hbo->distance);
+ nbo->mtu = htonl (hbo->mtu);
+ nbo->nt = htonl ((uint32_t) hbo->nt);
+ nbo->cc = htonl ((uint32_t) hbo->cc);
+}
+
+
/**
* Re-establish the connection to the ATS service.
*
(void) pid;
if (fc->session_id == sr->slot)
- {
- fc->sr = sr;
- return GNUNET_NO;
- }
+ {
+ fc->sr = sr;
+ return GNUNET_NO;
+ }
return GNUNET_YES;
}
: GNUNET_MESSAGE_TYPE_ATS_SESSION_ADD);
m->peer = ar->pid;
m->session_id = htonl (ar->slot);
- // FIXME: convert endianess here!
- // m->properties = ar->properties;
+ properties_hton (&m->properties,
+ &ar->properties);
GNUNET_memcpy (&m[1],
ar->address,
alen);
alen = strlen (address) + 1;
ar = GNUNET_malloc (sizeof (struct GNUNET_ATS_SessionRecord) + alen);
ar->ath = ath;
- ar->slot = 42; // FIXME: make up unique number!
+ ar->slot = s;
ar->session = session;
ar->address = (const char *) &ar[1];
ar->pid = *pid;
GNUNET_MESSAGE_TYPE_ATS_SESSION_UPDATE);
m->session_id = htonl (ar->slot);
m->peer = ar->pid;
- // FIXME: convert endianess here!
- // m->properties = ar->properties;
+ properties_hton (&m->properties,
+ &ar->properties);
GNUNET_MQ_send (ath->mq,
ev);
}