Commit e40d6dc0 authored by Aurelio Colosimo's avatar Aurelio Colosimo

state-initializing completed

parent 2e56afaf
......@@ -14,6 +14,7 @@
#include <net/if.h>
#include <arpa/inet.h>
#include <pproto/pproto.h>
#include <pproto/diag.h>
#include "posix.h"
......@@ -197,3 +198,24 @@ _end:
int pp_net_shutdown(struct pp_instance *ppi)
__attribute__((alias("posix_net_shutdown")));
extern UInteger32 posix_htonl(UInteger32 hostlong)
{
/* FIXME: compile (link) fails (arch 64 bit)
* return hotnl(hostlong); */
return 0; /* FIXME */
}
extern UInteger16 posix_htons(UInteger16 hostshort)
{
/* FIXME: compile (link) fails (arch 64 bit)
* return hotns(hostlong); */
return 0; /* FIXME */
}
UInteger32 pp_htonl(UInteger32 hostlong)
__attribute__((alias("posix_htonl")));
UInteger16 pp_htons(UInteger16 hostlong)
__attribute__((alias("posix_htons")));
......@@ -38,10 +38,12 @@ int main(int argc, char **argv)
ppi->portDS = calloc(1, sizeof(*ppi->portDS));
ppi->timePropertiesDS = calloc(1, sizeof(*ppi->timePropertiesDS));
ppi->net_path = calloc(1, sizeof(*ppi->net_path));
ppi->buf_out = calloc(1, PP_PACKET_SIZE);
ppi->buf_in = calloc(1, PP_PACKET_SIZE);
if ((!ppi->defaultDS) || (!ppi->currentDS) || (!ppi->parentDS)
|| (!ppi->portDS) || (!ppi->timePropertiesDS) || (!ppi->sent_seq_id)
|| (!ppi->net_path)
|| (!ppi->net_path) || (!ppi->buf_out) || (!ppi->buf_in)
)
exit(__LINE__);
......
......@@ -56,7 +56,6 @@
#define PP_PDELAY_RESP_FOLLOW_UP_LENGTH 54
#define PP_MANAGEMENT_LENGTH 48
/* UDP/IPv4 dependent */
#define PP_SUBDOMAIN_ADDRESS_LENGTH 4
#define PP_PORT_ADDRESS_LENGTH 2
......@@ -71,4 +70,5 @@
#define PP_MM_STARTING_BOUNDARY_HOPS 0x7fff
#endif /* __PTP_CONSTANTS_H__ */
......@@ -127,6 +127,8 @@ struct pp_instance {
Integer16 foreign_record_i;
Integer16 foreign_record_best;
Boolean record_update;
Octet *buf_out;
Octet *buf_in;
union {
MsgSync sync;
......@@ -169,7 +171,7 @@ extern int pp_net_shutdown(struct pp_instance *ppi);
extern int pp_recv_packet(struct pp_instance *ppi, void *pkt, int len);
extern int pp_send_packet(struct pp_instance *ppi, void *pkt, int len);
extern UInteger32 pp_htonl(UInteger32 hostlong);
extern UInteger16 pp_htons(UInteger16 hostlong);
extern UInteger16 pp_htons(UInteger16 hostshort);
/* Timers */
......
......@@ -54,14 +54,12 @@ int pp_initializing(struct pp_instance *ppi, unsigned char *pkt, int plen)
*
* Init all remaining stuff:
* initClock(rtOpts, ptpClock);
*
* Set myself as master (in case will not receive any announce):
* m1(ptpClock);
*
* Prepare a message:
* msgPackHeader(ptpClock->msgObuf,ptpClock);
*/
m1(ppi);
msg_pack_header(ppi->buf_out,ppi);
ppi->next_state = PPS_LISTENING;
return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment