2 * $Id: ORTEDomain.c,v 0.0.0.1 2003/08/21
4 * DEBUG: section 30 Domain functions
5 * AUTHOR: Petr Smolik petr.smolik@wo.cz
7 * ORTE - OCERA Real-Time Ethernet http://www.ocera.org/
8 * --------------------------------------------------------------------
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
24 /*****************************************************************************/
26 ORTEDomainStart(ORTEDomain *d,
27 Boolean recvMetatrafficThread,Boolean recvUserDataThread,Boolean sendThread) {
29 if ((recvMetatrafficThread) && (d->taskRecvMetatraffic.terminate)) {
30 d->taskRecvMetatraffic.terminate=ORTE_FALSE;
31 pthread_create(&d->taskRecvMetatraffic.thread, NULL,
32 (void*)&ORTEAppRecvMetatrafficThread, (void *)d);
34 if ((recvUserDataThread) && (d->taskRecvUserdata.terminate)) {
35 d->taskRecvUserdata.terminate=ORTE_FALSE;
36 pthread_create(&d->taskRecvUserdata.thread, NULL,
37 (void*)&ORTEAppRecvUserdataThread, (void *)d);
39 if ((sendThread) && (d->taskSend.terminate)) {
40 d->taskSend.terminate=ORTE_FALSE;
41 pthread_create(&d->taskSend.thread, NULL,
42 (void*)&ORTEAppSendThread, (void *)d);
46 /*****************************************************************************/
48 ORTEDomainPropDefaultGet(ORTEDomainProp *prop) {
51 memset(prop, 0, sizeof(*prop));
53 prop->multicast.enabled=ORTE_FALSE;
54 prop->multicast.ttl=1;
55 prop->multicast.loopBackEnabled=ORTE_TRUE;
60 sock_get_local_interfaces(&sock,prop->IFProp,&prop->IFCount);
63 prop->mgrs=NULL; //only from localhost
64 prop->appLocalManager=StringToIPAddress("127.0.0.1");
65 prop->keys=NULL; //are assign be orte
66 sprintf(prop->version,ORTE_PACKAGE_STRING\
72 prop->recvBuffSize=0x4000;
73 prop->sendBuffSize=0x4000;
74 prop->wireProp.metaBytesPerPacket=1500;
75 prop->wireProp.metaBytesPerFastPacket=1000;
76 prop->wireProp.metabitsPerACKBitmap=32;
77 prop->wireProp.userMaxSerDeserSize=0x4000;
80 NTPTIME_BUILD(prop->baseProp.expirationTime,180); //180s
81 NTPTIME_BUILD(prop->baseProp.refreshPeriod,72); //72s - refresh self parameters
82 NTPTIME_BUILD(prop->baseProp.purgeTime,60); //60s - purge time of parameters
83 NTPTIME_BUILD(prop->baseProp.repeatAnnounceTime,72);//72s - announcement by HB
84 NTPTIME_BUILD(prop->baseProp.repeatActiveQueryTime,72);//72s - announcement by ACK
85 NtpTimeAssembFromMs(prop->baseProp.delayResponceTimeACKMin,0,10);//10ms - delay before send ACK
86 NtpTimeAssembFromMs(prop->baseProp.delayResponceTimeACKMax,1,0);//1s
87 NtpTimeAssembFromMs(prop->baseProp.maxBlockTime,20,0);//20s
88 prop->baseProp.ACKMaxRetries=10;
89 prop->baseProp.HBMaxRetries=10;
91 PublParamsInit(&prop->publPropDefault);
92 SubsParamsInit(&prop->subsPropDefault);
97 /*****************************************************************************/
99 ORTEDomainInitEvents(ORTEDomainAppEvents *events) {
100 memset(events,0,sizeof(ORTEDomainAppEvents));