TCN TRDP2 D BOM 033 Xx TRDP Reference Manual

TCN-TRDP2-D-BOM-033-xx%20-%20TRDP%20Reference%20Manual

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 406

DownloadTCN-TRDP2-D-BOM-033-xx - TRDP Reference Manual
Open PDF In BrowserView PDF
TCNOpen TRDP Light
ReleaseV1.4

Generated by Doxygen 1.8.13

Contents

1

2

3

4

The TRDP Light Library API Specification

1

1.1

General Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1

1.1.1

Purpose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1

1.1.2

Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1

1.1.3

Related documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1

1.1.4

Abbreviations and Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

1

1.2

Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2

1.3

Conventions of the API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3

Data Structure Index

5

2.1

5

Data Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

File Index

7

3.1

7

File List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Data Structure Documentation

9

4.1

DNS_HEADER Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9

4.1.1

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9

GNU_PACKED Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

9

4.2

Detailed Description

4.2.1

Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

14

4.2.2

Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

4.2.2.1

confVehCnt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

4.2.2.2

confVehList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

4.2.2.3

cstList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

4.2.2.4

cstUUID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16

ii

CONTENTS

4.2.2.5

datasetLength . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16

4.2.2.6

deviceName . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16

4.2.2.7

etbId . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16

4.2.2.8

etbTopoCnt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16

4.2.2.9

inhibit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17

4.2.2.10 isLead . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17

4.2.2.11 leadDir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17

4.2.2.12 leadVehOfCst . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17

4.2.2.13 lifesign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17

4.2.2.14 msgType . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

17

4.2.2.15 opCstList . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

18

4.2.2.16 opTrnDirState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

18

4.2.2.17 opTrnTopoCnt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

18

4.2.2.18 opVehList

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

18

4.2.2.19 ownOpCstNo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

18

4.2.2.20 protocolVersion

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

4.2.2.21 reserved01 [1/2] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

4.2.2.22 reserved01 [2/2] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

4.2.2.23 reserved02 [1/2] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

4.2.2.24 reserved02 [2/2] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

4.2.2.25 reserved03 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

4.2.2.26 reserved04 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

20

4.2.2.27 reserved06 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

20

4.2.2.28 safetyTrail

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

20

4.2.2.29 trnCstNo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

20

4.2.2.30 trnDirState . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

20

4.2.2.31 trnId . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

21

4.2.2.32 trnNetDir . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

21

4.2.2.33 trnOperator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

21

4.2.2.34 trnTopoCnt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

21

Generated by Doxygen

CONTENTS

iii

4.2.2.35 trnVehNo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

21

4.2.2.36 vehId . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

21

4.2.2.37 vehOrient . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

22

4.2.2.38 version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

22

PD_ELE Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

22

4.3.1

Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

24

4.3.2

Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

24

4.3.2.1

pFrame . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

24

TAU_MARSHALL_INFO_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

24

4.4.1

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

25

TCN_URI Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

25

4.5.1

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

25

TRDP_CLTR_CST_INFO_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . .

25

4.6.1

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

26

TRDP_COMID_DSID_MAP_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . .

26

4.7.1

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

26

TRDP_CONSIST_INFO_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

26

4.8.1

Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

27

4.8.2

Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

28

4.8.2.1

cstId . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

28

4.8.2.2

cstOwner . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

28

TRDP_DATASET Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

28

4.9.1

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

29

4.10 TRDP_DATASET_ELEMENT_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . .

29

4.3

4.4

4.5

4.6

4.7

4.8

4.9

Detailed Description

Detailed Description

Detailed Description

Detailed Description

Detailed Description

4.10.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

30

4.11 TRDP_DBG_CONFIG_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

30

4.11.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

30

4.12 TRDP_DNS_REPLY Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

31

4.12.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

31

4.12.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

32

Generated by Doxygen

iv

CONTENTS

4.12.2.1 tcnUriCnt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

32

4.13 TRDP_DNS_REQUEST Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

32

4.13.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

33

4.13.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

33

4.13.2.1 tcnUriCnt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

33

4.14 TRDP_ETB_INFO_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

33

4.14.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

33

4.14.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

33

4.14.2.1 cnCnt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

34

4.15 TRDP_FUNCTION_INFO_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . .

34

4.15.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

34

4.15.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

34

4.15.2.1 cnId

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

35

4.15.2.2 cstVehNo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

35

4.15.2.3 etbId . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

35

4.15.2.4 fctId

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

35

4.16 TRDP_HANDLE Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

35

4.16.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

36

4.17 TRDP_LIST_STATISTICS_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . .

36

4.17.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

37

4.18 TRDP_MARSHALL_CONFIG_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . .

37

4.18.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

37

4.19 TRDP_MD_CONFIG_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

38

4.19.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4.20 TRDP_MD_INFO_T Struct Reference

39

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

39

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

40

4.21 TRDP_MD_STATISTICS_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . .

40

4.20.1 Detailed Description

4.21.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

41

4.22 TRDP_MEM_CONFIG_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

41

4.22.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

41

Generated by Doxygen

CONTENTS

v

4.23 TRDP_MEM_STATISTICS_T Struct Reference

. . . . . . . . . . . . . . . . . . . . . . . . . . .

42

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

42

4.24 TRDP_PD_CONFIG_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

42

4.23.1 Detailed Description

4.24.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

43

4.25 TRDP_PD_INFO_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

43

4.25.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

44

4.26 TRDP_PD_STATISTICS_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

44

4.26.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

45

4.27 TRDP_PROCESS_CONFIG_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . .

45

4.27.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4.28 TRDP_PROP_T Struct Reference

45

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

46

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

46

4.29 TRDP_PUB_STATISTICS_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . .

46

4.28.1 Detailed Description

4.29.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

47

4.29.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

47

4.29.2.1 destAddr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

47

4.30 TRDP_RED_STATISTICS_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . .

47

4.30.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

47

4.31 TRDP_SDT_PAR_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

47

4.31.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

48

4.32 TRDP_SEND_PARAM_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

48

4.32.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4.33 TRDP_SEQ_CNT_ENTRY_T Struct Reference

49

. . . . . . . . . . . . . . . . . . . . . . . . . . .

49

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

49

4.34 TRDP_SESSION Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

49

4.33.1 Detailed Description

4.34.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

50

4.35 TRDP_SOCKET_TCP Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

51

4.35.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4.36 TRDP_SOCKETS Struct Reference
4.36.1 Detailed Description
Generated by Doxygen

51

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

51

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

52

vi

CONTENTS

4.36.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4.36.2.1 usage

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4.37 TRDP_STATISTICS_REQUEST_T Struct Reference

52

52

. . . . . . . . . . . . . . . . . . . . . . . .

52

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

53

4.38 TRDP_STATISTICS_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

53

4.37.1 Detailed Description

4.38.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

54

4.39 TRDP_SUBS_STATISTICS_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . .

54

4.39.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

55

4.39.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

55

4.39.2.1 filterAddr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

55

4.39.2.2 timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

55

4.39.2.3 toBehav . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

56

4.40 TRDP_VEHICLE_INFO_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

56

4.40.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

57

4.40.2 Field Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

57

4.40.2.1 vehId . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

57

4.41 TRDP_XML_DOC_HANDLE_T Struct Reference

. . . . . . . . . . . . . . . . . . . . . . . . . .

57

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

57

4.42 VOS_SOCK_OPT_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

57

4.41.1 Detailed Description

4.42.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

58

4.43 VOS_VERSION_T Struct Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

58

4.43.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

58

Generated by Doxygen

CONTENTS

vii

5

File Documentation

59

5.1

iec61375-2-3.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

59

5.1.1

Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

63

5.1.2

Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

64

5.1.2.1

ETB_CTRL_COMID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

64

5.1.2.2

TRDP_ETBCTRL_DSID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

64

5.1.2.3

TRDP_MAX_FILE_NAME_LEN . . . . . . . . . . . . . . . . . . . . . . . . . .

64

5.1.2.4

TRDP_MAX_LABEL_LEN . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

64

5.1.2.5

TRDP_MAX_MD_DATA_SIZE

. . . . . . . . . . . . . . . . . . . . . . . . . .

64

5.1.2.6

TRDP_MAX_URI_HOST_LEN

. . . . . . . . . . . . . . . . . . . . . . . . . .

65

5.1.2.7

TRDP_MAX_URI_LEN

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

65

5.1.2.8

TRDP_MAX_URI_USER_LEN

. . . . . . . . . . . . . . . . . . . . . . . . . .

65

5.1.2.9

TRDP_MD_DEFAULT_REPLY_TIMEOUT . . . . . . . . . . . . . . . . . . . .

65

5.1.2.10 TRDP_MD_INFINITE_TIME . . . . . . . . . . . . . . . . . . . . . . . . . . . .

65

5.1.2.11 TRDP_MIN_PD_HEADER_SIZE . . . . . . . . . . . . . . . . . . . . . . . . .

65

5.1.2.12 TRDP_MSG_PD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

66

5.1.2.13 TRDP_PD_UDP_PORT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

66

5.1.2.14 TRDP_PROCESS_DEFAULT_CYCLE_TIME . . . . . . . . . . . . . . . . . . .

66

5.1.2.15 TRDP_USR_URI_SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

66

5.1.2.16 TTDB_NET_DIR_REQ_COMID . . . . . . . . . . . . . . . . . . . . . . . . . .

66

5.1.2.17 TTDB_OP_DIR_INFO_COMID . . . . . . . . . . . . . . . . . . . . . . . . . .

66

5.1.2.18 TTDB_STAT_CST_REQ_COMID . . . . . . . . . . . . . . . . . . . . . . . . .

67

5.1.2.19 TTDB_TRN_DIR_REQ_COMID . . . . . . . . . . . . . . . . . . . . . . . . . .

67

tau_cstinfo.c File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

67

5.2.1

Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

68

5.2.2

Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

68

5.2.2.1

68

5.2

5.3

cstInfoGetPropSize() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

tau_ctrl.c File Reference

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

69

5.3.1

Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

70

5.3.2

Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

71

Generated by Doxygen

viii

CONTENTS

5.4

5.5

5.6

5.7

5.3.2.1

tau_getEcspStat() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

71

5.3.2.2

tau_initEcspCtrl()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

71

5.3.2.3

tau_requestEcspConfirm() . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

73

5.3.2.4

tau_setEcspCtrl()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

73

5.3.2.5

tau_terminateEcspCtrl() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

74

tau_ctrl.h File Reference

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

74

5.4.1

Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

76

5.4.2

Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

77

5.4.2.1

tau_getEcspStat() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

77

5.4.2.2

tau_initEcspCtrl()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

77

5.4.2.3

tau_requestEcspConfirm() . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

78

5.4.2.4

tau_setEcspCtrl()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

78

5.4.2.5

tau_terminateEcspCtrl() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

79

tau_ctrl_types.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

79

5.5.1

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

81

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

82

Detailed Description

tau_dnr.c File Reference
5.6.1

Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

83

5.6.2

Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

84

5.6.2.1

tau_addr2Uri() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

84

5.6.2.2

tau_deInitDnr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

85

5.6.2.3

tau_DNRstatus() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

85

5.6.2.4

tau_getOwnAddr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

85

5.6.2.5

tau_initDnr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

86

5.6.2.6

tau_uri2Addr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

86

tau_dnr.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

87

5.7.1

Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

89

5.7.2

Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

89

5.7.2.1

tau_addr2Uri() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

89

5.7.2.2

tau_deInitDnr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

90

5.7.2.3

tau_DNRstatus() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

91

Generated by Doxygen

CONTENTS

5.8

5.9

ix

5.7.2.4

tau_getOwnAddr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

91

5.7.2.5

tau_initDnr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

92

5.7.2.6

tau_uri2Addr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

93

tau_dnr_types.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

93

5.8.1

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

95

tau_marshall.c File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

96

5.9.1

Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

97

5.9.2

Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

97

5.9.2.1

tau_calcDatasetSize() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

97

5.9.2.2

tau_calcDatasetSizeByComId() . . . . . . . . . . . . . . . . . . . . . . . . . .

98

5.9.2.3

tau_initMarshall() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

99

5.9.2.4

tau_marshall() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

99

5.9.2.5

tau_marshallDs() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

5.9.2.6

tau_unmarshall() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

5.9.2.7

tau_unmarshallDs() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101

Detailed Description

5.10 tau_marshall.h File Reference
5.10.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104

5.10.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
5.10.2.1 tau_calcDatasetSize() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
5.10.2.2 tau_calcDatasetSizeByComId() . . . . . . . . . . . . . . . . . . . . . . . . . . 106
5.10.2.3 tau_initMarshall() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
5.10.2.4 tau_marshall() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
5.10.2.5 tau_marshallDs() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
5.10.2.6 tau_unmarshall() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
5.10.2.7 tau_unmarshallDs() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
5.11 tau_tti.c File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
5.11.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113

5.11.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
5.11.2.1 TTI_CACHED_CONSISTS

. . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

5.11.3 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Generated by Doxygen

x

CONTENTS

5.11.3.1 tau_deInitTTI() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
5.11.3.2 tau_getCstFctCnt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
5.11.3.3 tau_getCstFctInfo()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115

5.11.3.4 tau_getCstInfo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
5.11.3.5 tau_getCstVehCnt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
5.11.3.6 tau_getOpTrDirectory()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

5.11.3.7 tau_getOpTrnDirectoryStatusInfo()

. . . . . . . . . . . . . . . . . . . . . . . . 117

5.11.3.8 tau_getOwnIds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
5.11.3.9 tau_getStaticCstInfo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
5.11.3.10 tau_getTrDirectory() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
5.11.3.11 tau_getTrnCstCnt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
5.11.3.12 tau_getTrnVehCnt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
5.11.3.13 tau_getTTI() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
5.11.3.14 tau_getVehInfo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
5.11.3.15 tau_getVehOrient() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
5.11.3.16 tau_initTTIaccess() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
5.12 tau_tti.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
5.12.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126

5.12.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
5.12.2.1 tau_deInitTTI() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126
5.12.2.2 tau_getCstFctCnt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
5.12.2.3 tau_getCstFctInfo()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127

5.12.2.4 tau_getCstInfo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
5.12.2.5 tau_getCstVehCnt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
5.12.2.6 tau_getOpTrDirectory()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129

5.12.2.7 tau_getOpTrnDirectoryStatusInfo()

. . . . . . . . . . . . . . . . . . . . . . . . 130

5.12.2.8 tau_getOwnIds() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
5.12.2.9 tau_getStaticCstInfo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
5.12.2.10 tau_getTrDirectory() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
5.12.2.11 tau_getTrnCstCnt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Generated by Doxygen

CONTENTS

xi

5.12.2.12 tau_getTrnVehCnt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
5.12.2.13 tau_getTTI() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
5.12.2.14 tau_getVehInfo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
5.12.2.15 tau_getVehOrient() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
5.12.2.16 tau_initTTIaccess() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
5.13 tau_tti_types.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
5.13.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138

5.14 tau_xml.c File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
5.14.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

5.14.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
5.14.2.1 TRDP_SDT_DEFAULT_CMTHR . . . . . . . . . . . . . . . . . . . . . . . . . 141
5.14.3 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
5.14.3.1 tau_freeTelegrams() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
5.14.3.2 tau_freeXmlDatasetConfig() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
5.14.3.3 tau_freeXmlDoc() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
5.14.3.4 tau_prepareXmlDoc() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
5.14.3.5 tau_readXmlDatasetConfig() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
5.14.3.6 tau_readXmlDeviceConfig() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
5.14.3.7 tau_readXmlInterfaceConfig() . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
5.15 tau_xml.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
5.15.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148

5.15.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
5.15.2.1 TRDP_DBG_DEFAULT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
5.15.3 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
5.15.3.1 TRDP_EXCHG_OPTION_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
5.15.4 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
5.15.4.1 tau_freeTelegrams() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
5.15.4.2 tau_freeXmlDatasetConfig() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
5.15.4.3 tau_freeXmlDoc() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
5.15.4.4 tau_prepareXmlDoc() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Generated by Doxygen

xii

CONTENTS

5.15.4.5 tau_readXmlDatasetConfig() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
5.15.4.6 tau_readXmlDeviceConfig() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
5.15.4.7 tau_readXmlInterfaceConfig() . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
5.16 trdp_dllmain.c File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
5.16.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

5.17 trdp_if.c File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
5.17.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156

5.17.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
5.17.2.1 tlc_closeSession() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
5.17.2.2 tlc_configSession() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
5.17.2.3 tlc_getETBTopoCount() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
5.17.2.4 tlc_getInterval()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

5.17.2.5 tlc_getOpTrainTopoCount()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . 159

5.17.2.6 tlc_getOwnIpAddress() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
5.17.2.7 tlc_getVersion()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160

5.17.2.8 tlc_getVersionString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
5.17.2.9 tlc_init() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
5.17.2.10 tlc_openSession() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
5.17.2.11 tlc_process() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
5.17.2.12 tlc_reinitSession() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
5.17.2.13 tlc_setETBTopoCount() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
5.17.2.14 tlc_setOpTrainTopoCount()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

5.17.2.15 tlc_terminate() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
5.17.2.16 tlp_get() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
5.17.2.17 tlp_getRedundant()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165

5.17.2.18 tlp_publish() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
5.17.2.19 tlp_put() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
5.17.2.20 tlp_republish() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
5.17.2.21 tlp_request() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
5.17.2.22 tlp_resubscribe() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
Generated by Doxygen

CONTENTS

xiii

5.17.2.23 tlp_setRedundant() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
5.17.2.24 tlp_subscribe() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
5.17.2.25 tlp_unpublish() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
5.17.2.26 tlp_unsubscribe()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

5.17.2.27 trdp_isValidSession()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

5.17.2.28 trdp_sessionQueue() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
5.18 trdp_if.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
5.18.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

5.18.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
5.18.2.1 trdp_isValidSession()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

5.18.2.2 trdp_sessionQueue() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
5.19 trdp_if_light.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
5.19.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179

5.19.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
5.19.2.1 tlc_closeSession() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
5.19.2.2 tlc_configSession() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
5.19.2.3 tlc_freeBuf() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
5.19.2.4 tlc_getETBTopoCount() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
5.19.2.5 tlc_getInterval()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182

5.19.2.6 tlc_getJoinStatistics()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182

5.19.2.7 tlc_getOpTrainTopoCount()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . 183

5.19.2.8 tlc_getOwnIpAddress() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
5.19.2.9 tlc_getPubStatistics()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184

5.19.2.10 tlc_getRedStatistics()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185

5.19.2.11 tlc_getStatistics() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
5.19.2.12 tlc_getSubsStatistics() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
5.19.2.13 tlc_getTcpListStatistics() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
5.19.2.14 tlc_getUdpListStatistics() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
5.19.2.15 tlc_getVersion()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188

5.19.2.16 tlc_getVersionString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
Generated by Doxygen

xiv

CONTENTS

5.19.2.17 tlc_init() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
5.19.2.18 tlc_openSession() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
5.19.2.19 tlc_process() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
5.19.2.20 tlc_reinitSession() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
5.19.2.21 tlc_resetStatistics() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
5.19.2.22 tlc_setETBTopoCount() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
5.19.2.23 tlc_setOpTrainTopoCount()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . 192

5.19.2.24 tlc_terminate() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
5.19.2.25 tlm_abortSession() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
5.19.2.26 tlm_addListener()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194

5.19.2.27 tlm_confirm() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
5.19.2.28 tlm_delListener() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
5.19.2.29 tlm_notify() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
5.19.2.30 tlm_readdListener() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
5.19.2.31 tlm_reply() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
5.19.2.32 tlm_replyQuery() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 198
5.19.2.33 tlm_request() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
5.19.2.34 tlp_get() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
5.19.2.35 tlp_getRedundant()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201

5.19.2.36 tlp_publish() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
5.19.2.37 tlp_put() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
5.19.2.38 tlp_republish() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
5.19.2.39 tlp_request() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
5.19.2.40 tlp_resubscribe() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
5.19.2.41 tlp_setRedundant() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
5.19.2.42 tlp_subscribe() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
5.19.2.43 tlp_unpublish() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
5.19.2.44 tlp_unsubscribe()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210

5.20 trdp_mdcom.c File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 210
5.20.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
Generated by Doxygen

CONTENTS

xv

5.20.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
5.20.2.1 trdp_mdCall()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213

5.20.2.2 trdp_mdCheckListenSocks() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
5.20.2.3 trdp_mdCheckPending() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
5.20.2.4 trdp_mdCheckTimeouts() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
5.20.2.5 trdp_mdConfirm() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
5.20.2.6 trdp_mdFreeSession() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
5.20.2.7 trdp_mdGetTCPSocket() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
5.20.2.8 trdp_mdReply()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216

5.20.2.9 trdp_mdSend() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
5.21 trdp_mdcom.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
5.21.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219

5.21.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
5.21.2.1 trdp_mdCall()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220

5.21.2.2 trdp_mdCheckListenSocks() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
5.21.2.3 trdp_mdCheckPending() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
5.21.2.4 trdp_mdCheckTimeouts() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221
5.21.2.5 trdp_mdConfirm() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
5.21.2.6 trdp_mdFreeSession() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
5.21.2.7 trdp_mdGetTCPSocket() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
5.21.2.8 trdp_mdReply()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223

5.21.2.9 trdp_mdSend() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
5.22 trdp_pdcom.c File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224
5.22.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

5.22.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
5.22.2.1 trdp_pdCheck()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227

5.22.2.2 trdp_pdCheckListenSocks() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
5.22.2.3 trdp_pdCheckPending() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
5.22.2.4 trdp_pdDistribute() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228
5.22.2.5 trdp_pdHandleTimeOuts() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Generated by Doxygen

xvi

CONTENTS

5.22.2.6 trdp_pdInit() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
5.22.2.7 trdp_pdPut() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230
5.22.2.8 trdp_pdReceive() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
5.22.2.9 trdp_pdSend() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
5.22.2.10 trdp_pdSendQueued() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
5.22.2.11 trdp_pdUpdate() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
5.23 trdp_pdcom.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
5.23.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235

5.23.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
5.23.2.1 trdp_pdCheck()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235

5.23.2.2 trdp_pdCheckListenSocks() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
5.23.2.3 trdp_pdCheckPending() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
5.23.2.4 trdp_pdDistribute() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 236
5.23.2.5 trdp_pdHandleTimeOuts() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
5.23.2.6 trdp_pdInit() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238
5.23.2.7 trdp_pdPut() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
5.23.2.8 trdp_pdReceive() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
5.23.2.9 trdp_pdSend() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
5.23.2.10 trdp_pdSendQueued() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
5.23.2.11 trdp_pdUpdate() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
5.24 trdp_private.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
5.24.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244

5.24.2 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
5.24.2.1 TRDP_MD_ELE_ST_T

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245

5.24.2.2 TRDP_SOCK_TYPE_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
5.25 trdp_stats.c File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
5.25.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

5.25.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247
5.25.2.1 tlc_getJoinStatistics()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247

5.25.2.2 tlc_getPubStatistics()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Generated by Doxygen

CONTENTS

xvii

5.25.2.3 tlc_getRedStatistics()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248

5.25.2.4 tlc_getStatistics() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
5.25.2.5 tlc_getSubsStatistics() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249
5.25.2.6 tlc_resetStatistics() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
5.25.2.7 trdp_initStats() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
5.25.2.8 trdp_pdPrepareStats() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
5.25.2.9 trdp_UpdateStats() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
5.26 trdp_stats.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252
5.26.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253

5.26.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
5.26.2.1 trdp_initStats() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
5.26.2.2 trdp_pdPrepareStats() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
5.27 trdp_types.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254
5.27.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259

5.27.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
5.27.2.1 TRDP_FLAGS_DEFAULT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
5.27.3 Typedef Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
5.27.3.1 TRDP_IP_ADDR_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
5.27.3.2 TRDP_MARSHALL_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260
5.27.3.3 TRDP_MD_CALLBACK_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
5.27.3.4 TRDP_PD_CALLBACK_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
5.27.3.5 TRDP_PRINT_DBG_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
5.27.3.6 TRDP_TIME_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261
5.27.3.7 TRDP_UNMARSHALL_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
5.27.4 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262
5.27.4.1 TRDP_DATA_TYPE_T

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262

5.27.4.2 TRDP_ERR_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263
5.27.4.3 TRDP_RED_STATE_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
5.27.4.4 TRDP_REPLY_STATUS_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
5.27.4.5 TRDP_TO_BEHAVIOR_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264
Generated by Doxygen

xviii

CONTENTS

5.28 trdp_utils.c File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265
5.28.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266

5.28.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267
5.28.2.1 trdp_checkSequenceCounter()

. . . . . . . . . . . . . . . . . . . . . . . . . . 267

5.28.2.2 trdp_findMCjoins() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268
5.28.2.3 trdp_getCurrentMaxSocketCnt() . . . . . . . . . . . . . . . . . . . . . . . . . . 268
5.28.2.4 trdp_getSeqCnt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
5.28.2.5 trdp_initSockets()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269

5.28.2.6 trdp_isAddressed() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
5.28.2.7 trdp_isInIPrange() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
5.28.2.8 trdp_packetSizeMD() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
5.28.2.9 trdp_packetSizePD() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270
5.28.2.10 trdp_queueAppLast()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271

5.28.2.11 trdp_queueDelElement() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
5.28.2.12 trdp_queueFindComId() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
5.28.2.13 trdp_queueFindPubAddr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
5.28.2.14 trdp_queueFindSubAddr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
5.28.2.15 trdp_queueInsFirst() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
5.28.2.16 trdp_releaseSocket() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
5.28.2.17 trdp_requestSocket() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
5.28.2.18 trdp_resetSequenceCounter() . . . . . . . . . . . . . . . . . . . . . . . . . . . 275
5.28.2.19 trdp_validTopoCounters() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
5.29 trdp_utils.h File Reference
5.29.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 278

5.29.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
5.29.2.1 trdp_checkSequenceCounter()

. . . . . . . . . . . . . . . . . . . . . . . . . . 279

5.29.2.2 trdp_findMCjoins() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 280
5.29.2.3 trdp_getCurrentMaxSocketCnt() . . . . . . . . . . . . . . . . . . . . . . . . . . 280
5.29.2.4 trdp_getSeqCnt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
5.29.2.5 trdp_initSockets()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 281
Generated by Doxygen

CONTENTS

xix

5.29.2.6 trdp_initUncompletedTCP() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
5.29.2.7 trdp_isAddressed() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
5.29.2.8 trdp_isInIPrange() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 282
5.29.2.9 trdp_packetSizeMD() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
5.29.2.10 trdp_packetSizePD() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
5.29.2.11 trdp_queueAppLast()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285

5.29.2.12 trdp_queueDelElement() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
5.29.2.13 trdp_queueFindComId() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
5.29.2.14 trdp_queueFindPubAddr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
5.29.2.15 trdp_queueFindSubAddr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
5.29.2.16 trdp_queueInsFirst() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
5.29.2.17 trdp_releaseSocket() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
5.29.2.18 trdp_requestSocket() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 288
5.29.2.19 trdp_resetSequenceCounter() . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
5.29.2.20 trdp_validTopoCounters() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289
5.30 trdp_xml.c File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
5.30.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291

5.30.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
5.30.2.1 trdp_XMLClose() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291
5.30.2.2 trdp_XMLCountStartTag() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
5.30.2.3 trdp_XMLEnter() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
5.30.2.4 trdp_XMLGetAttribute() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 292
5.30.2.5 trdp_XMLLeave()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293

5.30.2.6 trdp_XMLOpen() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
5.30.2.7 trdp_XMLRewind() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
5.30.2.8 trdp_XMLSeekStartTag()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294

5.30.2.9 trdp_XMLSeekStartTagAny()

. . . . . . . . . . . . . . . . . . . . . . . . . . . 294

5.31 trdp_xml.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
5.31.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296

5.31.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Generated by Doxygen

xx

CONTENTS

5.31.2.1 trdp_XMLClose() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
5.31.2.2 trdp_XMLCountStartTag() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
5.31.2.3 trdp_XMLEnter() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
5.31.2.4 trdp_XMLGetAttribute() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
5.31.2.5 trdp_XMLLeave()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298

5.31.2.6 trdp_XMLOpen() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
5.31.2.7 trdp_XMLRewind() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
5.31.2.8 trdp_XMLSeekStartTag()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299

5.31.2.9 trdp_XMLSeekStartTagAny()

. . . . . . . . . . . . . . . . . . . . . . . . . . . 300

5.32 vos_mem.c File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 300
5.32.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302

5.32.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
5.32.2.1 vos_bsearch() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
5.32.2.2 vos_memAlloc() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
5.32.2.3 vos_memCount() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
5.32.2.4 vos_memDelete() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
5.32.2.5 vos_memFree() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
5.32.2.6 vos_memInit() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 304
5.32.2.7 vos_qsort() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 305
5.32.2.8 vos_queueCreate()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306

5.32.2.9 vos_queueDestroy() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
5.32.2.10 vos_queueReceive() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
5.32.2.11 vos_queueSend() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 307
5.32.2.12 vos_strncat() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
5.32.2.13 vos_strncpy() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
5.32.2.14 vos_strnicmp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 308
5.33 vos_mem.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 309
5.33.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311

5.33.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
5.33.2.1 VOS_MEM_BLOCKSIZES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
Generated by Doxygen

CONTENTS

xxi

5.33.2.2 VOS_MEM_PREALLOCATE . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
5.33.3 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
5.33.3.1 vos_bsearch() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 312
5.33.3.2 vos_memAlloc() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
5.33.3.3 vos_memCount() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313
5.33.3.4 vos_memDelete() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
5.33.3.5 vos_memFree() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
5.33.3.6 vos_memInit() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 314
5.33.3.7 vos_qsort() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 315
5.33.3.8 vos_queueCreate()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316

5.33.3.9 vos_queueDestroy() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
5.33.3.10 vos_queueReceive() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
5.33.3.11 vos_queueSend() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317
5.33.3.12 vos_strncat() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
5.33.3.13 vos_strncpy() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 318
5.33.3.14 vos_strnicmp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
5.34 vos_shared_mem.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
5.34.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320

5.34.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
5.34.2.1 vos_sharedClose() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
5.34.2.2 vos_sharedOpen() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
5.35 vos_sock.h File Reference
5.35.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324

5.35.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
5.35.2.1 VOS_MAX_SOCKET_CNT . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
5.35.2.2 VOS_TTL_MULTICAST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
5.35.3 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
5.35.3.1 vos_determineBindAddr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
5.35.3.2 vos_dottedIP() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
5.35.3.3 vos_getInterfaces() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 326
Generated by Doxygen

xxii

CONTENTS

5.35.3.4 vos_htonl() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
5.35.3.5 vos_htonll() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327
5.35.3.6 vos_htons()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 327

5.35.3.7 vos_ipDotted() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
5.35.3.8 vos_isMulticast() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 328
5.35.3.9 vos_netIfUp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
5.35.3.10 vos_ntohl() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
5.35.3.11 vos_ntohll() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329
5.35.3.12 vos_ntohs()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330

5.35.3.13 vos_select() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
5.35.3.14 vos_sockAccept() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
5.35.3.15 vos_sockBind() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
5.35.3.16 vos_sockClose() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 331
5.35.3.17 vos_sockConnect()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332

5.35.3.18 vos_sockGetMAC() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
5.35.3.19 vos_sockInit() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
5.35.3.20 vos_sockJoinMC() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
5.35.3.21 vos_sockLeaveMC() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
5.35.3.22 vos_sockListen() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334
5.35.3.23 vos_sockOpenTCP() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
5.35.3.24 vos_sockOpenUDP()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335

5.35.3.25 vos_sockReceiveTCP() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 335
5.35.3.26 vos_sockReceiveUDP() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 336
5.35.3.27 vos_sockSendTCP() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
5.35.3.28 vos_sockSendUDP() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
5.35.3.29 vos_sockSetMulticastIf() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
5.35.3.30 vos_sockSetOptions() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 338
5.35.3.31 vos_sockTerm() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
5.36 vos_thread.h File Reference

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339

5.36.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341
Generated by Doxygen

CONTENTS

xxiii

5.36.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
5.36.2.1 vos_addTime() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
5.36.2.2 vos_clearTime() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342
5.36.2.3 vos_cmpTime()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 342

5.36.2.4 vos_cyclicThread() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
5.36.2.5 vos_divTime() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
5.36.2.6 vos_getTime() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
5.36.2.7 vos_getTimeStamp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
5.36.2.8 vos_getUuid() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
5.36.2.9 vos_mulTime() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
5.36.2.10 vos_mutexCreate() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
5.36.2.11 vos_mutexDelete() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 346
5.36.2.12 vos_mutexLock() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
5.36.2.13 vos_mutexTryLock() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
5.36.2.14 vos_mutexUnlock() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 347
5.36.2.15 vos_semaCreate() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
5.36.2.16 vos_semaDelete() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
5.36.2.17 vos_semaGive() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 348
5.36.2.18 vos_semaTake() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
5.36.2.19 vos_subTime() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
5.36.2.20 vos_threadCreate()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350

5.36.2.21 vos_threadDelay() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 350
5.36.2.22 vos_threadInit()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351

5.36.2.23 vos_threadIsActive() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
5.36.2.24 vos_threadSelf() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351
5.36.2.25 vos_threadTerm() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
5.36.2.26 vos_threadTerminate() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
5.37 vos_types.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 352
5.37.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 354

5.37.2 Typedef Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
Generated by Doxygen

xxiv

CONTENTS

5.37.2.1 VOS_PRINT_DBG_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
5.37.2.2 VOS_TIMEVAL_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
5.37.3 Enumeration Type Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
5.37.3.1 VOS_ERR_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 355
5.37.3.2 VOS_LOG_T . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
5.38 vos_utils.c File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356
5.38.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 357

5.38.2 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358
5.38.2.1 vos_crc32()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358

5.38.2.2 vos_getErrorString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
5.38.2.3 vos_getVersion() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
5.38.2.4 vos_getVersionString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
5.38.2.5 vos_init() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
5.38.2.6 vos_sc32() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
5.38.2.7 vos_terminate()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360

5.39 vos_utils.h File Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361
5.39.1 Detailed Description

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 362

5.39.2 Macro Definition Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
5.39.2.1 INITFCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
5.39.2.2 VOS_MAX_ERR_STR_SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
5.39.2.3 VOS_MAX_FRMT_SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
5.39.2.4 VOS_MAX_PRNT_STR_SIZE . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
5.39.3 Function Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
5.39.3.1 vos_crc32()

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363

5.39.3.2 vos_getErrorString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
5.39.3.3 vos_getVersion() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364
5.39.3.4 vos_getVersionString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
5.39.3.5 vos_init() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
5.39.3.6 vos_sc32() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
5.39.3.7 vos_terminate()

Index

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367

369
Generated by Doxygen

Chapter 1

The TRDP Light Library API Specification

1.1

General Information

1.1.1

Purpose

The TRDP protocol has been defined as the standard communication protocol in IP-enabled trains. It allows communication via process data (periodically transmitted data using UDP/IP) and message data (client - server messaging
using UDP/IP or TCP/IP) This document describes the light API of the TRDP Library.

1.1.2

Scope

The intended audience of this document is the developers and project members of the TRDP project. TRDP Client
Applications are programs using the TRDP protocol library to access the services of TRDP. Programmers developing
such applications are the main target audience for this documentation.

1.1.3

Related documents

TCN-TRDP2-D-BOM-004-01 IEC61375-2-3_CD_ANNEXA Protocol definition of the TRDP standard

1.1.4

Abbreviations and Definitions

-API Application Programming Interface -ECN Ethernet Consist Network -TRDP Train Real-time Data Protocol
-TCMS Train Control Management System

2

1.2

The TRDP Light Library API Specification

Terminology

The API documented here is mainly concerned with three bodies of code:

• TRDP Client Applications (or 'client applications' for short): These are programs using the API to access the
services of TRDP. Programmers developing such applications are the main target audience for this documentation.
• TRDP Light Implementations (or just 'TRDP implementation'): These are libraries realising the API as documented here. Programmers developing such implementations will find useful definitions about syntax and
semantics of the API wihtin this documentation.
• VOS Subsystem (Virtual Operating System): An OS and hardware abstraction layer which offers memory,
networking, threading, queues and debug functions. The VOS API is documented here.

The following diagram shows how these pieces of software are interrelated.

TLC_init

TLC_openSession

TLP_subscribe()
TLP_subscribe

TLP_publish()
TLP_publish

Main workloop

TLC_getInterval()

select()

PD Callback

comID,
status

Received
data handling

Received
data handling

TLC_process()

No

more input
?

application
dataprocess
handling
application
application
applicationprocess
process

TLP_put()

Shutdown
?

TLC_closeSession()

TLC_terminate()

Figure 1.1 Sample client workflow

Generated by Doxygen

1.3 Conventions of the API

1.3

3

Conventions of the API

The API comprises a set of C header files that can also be used from client applications written in C++. These
header files are contained in a directory named trdp/api and a subdirectory called trdp/vos/api with declarations not topical to TRDP but needed by the stack. Client applications shall include these header files like:

#include "trdp_if_light.h"

and, if VOS functions are needed, also the corresponding headers:

#include "vos_thread.h"

for example.
The subdirectory trdp/doc contains files needed for the API documentation.
Generally client application source code including API headers will only compile if the parent directory of the trdp
directory is part of the include path of the used compiler. No other subdirectories of the API should be added to the
compiler's include path.
The client API doesn't support a "catch-all" header file that includes all declarations in one step; rather the client
application has to include individual headers for each feature set it wants to use.

Generated by Doxygen

4

The TRDP Light Library API Specification

Generated by Doxygen

Chapter 2

Data Structure Index
2.1

Data Structures

Here are the data structures with brief descriptions:
DNS_HEADER
DNS header structure . . . . . . . . . . . . . . . . . .
GNU_PACKED
Types for ETB control . . . . . . . . . . . . . . . . . . .
PD_ELE
Queue element for PD packets to send or receive . . . .
TAU_MARSHALL_INFO_T
Marshalling info, used to and from wire . . . . . . . . . .
TCN_URI
TCN-DNS simplified header structures . . . . . . . . . .
TRDP_CLTR_CST_INFO_T
Closed train consists information . . . . . . . . . . . . .
TRDP_COMID_DSID_MAP_T
ComId - data set mapping element definition . . . . . . .
TRDP_CONSIST_INFO_T
Consist information structure . . . . . . . . . . . . . . .
TRDP_DATASET
Dataset definition . . . . . . . . . . . . . . . . . . . . .
TRDP_DATASET_ELEMENT_T
Dataset element definition . . . . . . . . . . . . . . . .
TRDP_DBG_CONFIG_T
Control for debug output device/file on application level .
TRDP_DNS_REPLY
TCN-DNS Reply telegram TCN_DNS_REP_DS . . . . .
TRDP_DNS_REQUEST
TCN-DNS Request telegram TCN_DNS_REQ_DS . . .
TRDP_ETB_INFO_T
Types for train configuration information . . . . . . . . .
TRDP_FUNCTION_INFO_T
Function/device information structure . . . . . . . . . .
TRDP_HANDLE
Hidden handle definition, used as unique addressing item
TRDP_LIST_STATISTICS_T
Information about a particular MD listener . . . . . . . .
TRDP_MARSHALL_CONFIG_T
Marshaling/unmarshalling configuration . . . . . . . . .

. . . . . . . . . . . . . . . . . . . .

9

. . . . . . . . . . . . . . . . . . . .

9

. . . . . . . . . . . . . . . . . . . .

22

. . . . . . . . . . . . . . . . . . . .

24

. . . . . . . . . . . . . . . . . . . .

25

. . . . . . . . . . . . . . . . . . . .

25

. . . . . . . . . . . . . . . . . . . .

26

. . . . . . . . . . . . . . . . . . . .

26

. . . . . . . . . . . . . . . . . . . .

28

. . . . . . . . . . . . . . . . . . . .

29

. . . . . . . . . . . . . . . . . . . .

30

. . . . . . . . . . . . . . . . . . . .

31

. . . . . . . . . . . . . . . . . . . .

32

. . . . . . . . . . . . . . . . . . . .

33

. . . . . . . . . . . . . . . . . . . .

34

. . . . . . . . . . . . . . . . . . . .

35

. . . . . . . . . . . . . . . . . . . .

36

. . . . . . . . . . . . . . . . . . . .

37

6

Data Structure Index

TRDP_MD_CONFIG_T
Default MD configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TRDP_MD_INFO_T
Message data info from received telegram; allows the application to generate responses
TRDP_MD_STATISTICS_T
Structure containing all general MD statistics information . . . . . . . . . . . . . . . .
TRDP_MEM_CONFIG_T
Enumeration type for memory pre-fragmentation, reuse of VOS definition . . . . . . . .
TRDP_MEM_STATISTICS_T
Structure containing all general memory statistics information . . . . . . . . . . . . . .
TRDP_PD_CONFIG_T
Default PD configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TRDP_PD_INFO_T
Process data info from received telegram; allows the application to generate responses
TRDP_PD_STATISTICS_T
Structure containing all general PD statistics information . . . . . . . . . . . . . . . .
TRDP_PROCESS_CONFIG_T
Various flags/general TRDP options for library initialization . . . . . . . . . . . . . . .
TRDP_PROP_T
Application defined properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TRDP_PUB_STATISTICS_T
Table containing particular PD publishing information . . . . . . . . . . . . . . . . . .
TRDP_RED_STATISTICS_T
A table containing PD redundant group information . . . . . . . . . . . . . . . . . . .
TRDP_SDT_PAR_T
Types to read out the XML configuration . . . . . . . . . . . . . . . . . . . . . . . . .
TRDP_SEND_PARAM_T
Quality/type of service and time to live . . . . . . . . . . . . . . . . . . . . . . . . . .
TRDP_SEQ_CNT_ENTRY_T
Tuples of last received sequence counter per comId . . . . . . . . . . . . . . . . . . .
TRDP_SESSION
Session/application variables store . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TRDP_SOCKET_TCP
TCP parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TRDP_SOCKETS
Socket item . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TRDP_STATISTICS_REQUEST_T
TRDP statistics type definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TRDP_STATISTICS_T
Structure containing all general memory, PD and MD statistics information . . . . . . .
TRDP_SUBS_STATISTICS_T
Table containing particular PD subscription information . . . . . . . . . . . . . . . . .
TRDP_VEHICLE_INFO_T
Vehicle information structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
TRDP_XML_DOC_HANDLE_T
Parsed XML document handle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
VOS_SOCK_OPT_T
Common socket options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
VOS_VERSION_T
Version information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . .

38

. . .

39

. . . .

40

. . . .

41

. . . .

42

. . . .

42

. . . .

43

. . . .

44

. . . .

45

. . . .

46

. . . .

46

. . . .

47

. . . .

47

. . . .

48

. . . .

49

. . . .

49

. . . .

51

. . . .

51

. . . .

52

. . . .

53

. . . .

54

. . . .

56

. . . .

57

. . . .

57

. . . .

58

Generated by Doxygen

Chapter 3

File Index
3.1

File List

Here is a list of all documented files with brief descriptions:
iec61375-2-3.h
All definitions from IEC 61375-2-3 . . . . . .
tau_cstinfo.c
Functions for consist information access . . .
tau_ctrl.c
Functions for train switch control . . . . . . .
tau_ctrl.h
TRDP utility interface definitions . . . . . . .
tau_ctrl_types.h
TRDP utility interface definitions . . . . . . .
tau_dnr.c
Functions for domain name resolution . . . .
tau_dnr.h
TRDP utility interface definitions . . . . . . .
tau_dnr_types.h
TRDP utility interface definitions . . . . . . .
tau_marshall.c
Marshalling functions for TRDP . . . . . . . .
tau_marshall.h
TRDP utility interface definitions . . . . . . .
tau_tti.c
Functions for train topology information access
tau_tti.h
TRDP utility interface definitions . . . . . . .
tau_tti_types.h
TRDP utility interface definitions . . . . . . .
tau_xml.c
Functions for XML file parsing . . . . . . . .
tau_xml.h
TRDP utility interface definitions . . . . . . .
trdp_dllmain.c
Windows DLL main function . . . . . . . . .
trdp_if.c
Functions for ECN communication . . . . . .
trdp_if.h
Typedefs for TRDP communication . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . .

59

. . . . . . . . . . . . . . . . . . . . . . . . . .

67

. . . . . . . . . . . . . . . . . . . . . . . . . .

69

. . . . . . . . . . . . . . . . . . . . . . . . . .

74

. . . . . . . . . . . . . . . . . . . . . . . . . .

79

. . . . . . . . . . . . . . . . . . . . . . . . . .

82

. . . . . . . . . . . . . . . . . . . . . . . . . .

87

. . . . . . . . . . . . . . . . . . . . . . . . . .

93

. . . . . . . . . . . . . . . . . . . . . . . . . .

96

. . . . . . . . . . . . . . . . . . . . . . . . . . 102
. . . . . . . . . . . . . . . . . . . . . . . . . 112
. . . . . . . . . . . . . . . . . . . . . . . . . . 123
. . . . . . . . . . . . . . . . . . . . . . . . . . 136
. . . . . . . . . . . . . . . . . . . . . . . . . . 139
. . . . . . . . . . . . . . . . . . . . . . . . . . 145
. . . . . . . . . . . . . . . . . . . . . . . . . . 153
. . . . . . . . . . . . . . . . . . . . . . . . . . 154
. . . . . . . . . . . . . . . . . . . . . . . . . . 172

8

File Index

trdp_if_light.h
TRDP Light interface functions (API) . . . . . .
trdp_mdcom.c
Functions for MD communication . . . . . . . .
trdp_mdcom.h
Functions for MD communication . . . . . . . .
trdp_pdcom.c
Functions for PD communication . . . . . . . .
trdp_pdcom.h
Functions for PD communication . . . . . . . .
trdp_private.h
Typedefs for TRDP communication . . . . . . .
trdp_stats.c
Statistics functions for TRDP communication .
trdp_stats.h
Statistics for TRDP communication . . . . . . .
trdp_types.h
Typedefs for TRDP communication . . . . . . .
trdp_utils.c
Helper functions for TRDP communication . . .
trdp_utils.h
Common utilities for TRDP communication . . .
trdp_xml.c
Simple XML parser . . . . . . . . . . . . . . .
trdp_xml.h
Simple XML parser . . . . . . . . . . . . . . .
vos_mem.c
Memory functions . . . . . . . . . . . . . . . .
vos_mem.h
Memory and queue functions for OS abstraction
vos_shared_mem.h
Shared Memory functions for OS abstraction .
vos_sock.h
Typedefs for OS abstraction . . . . . . . . . .
vos_thread.h
Threading functions for OS abstraction . . . . .
vos_types.h
Typedefs for OS abstraction . . . . . . . . . .
vos_utils.c
Common functions for VOS . . . . . . . . . . .
vos_utils.h
Typedefs for OS abstraction . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . 175
. . . . . . . . . . . . . . . . . . . . . . . . . 210
. . . . . . . . . . . . . . . . . . . . . . . . . 217
. . . . . . . . . . . . . . . . . . . . . . . . . 224
. . . . . . . . . . . . . . . . . . . . . . . . . 233
. . . . . . . . . . . . . . . . . . . . . . . . . 241
. . . . . . . . . . . . . . . . . . . . . . . . . 245
. . . . . . . . . . . . . . . . . . . . . . . . . 252
. . . . . . . . . . . . . . . . . . . . . . . . . 254
. . . . . . . . . . . . . . . . . . . . . . . . . 265
. . . . . . . . . . . . . . . . . . . . . . . . . 276
. . . . . . . . . . . . . . . . . . . . . . . . . 290
. . . . . . . . . . . . . . . . . . . . . . . . . 295
. . . . . . . . . . . . . . . . . . . . . . . . . 300
. . . . . . . . . . . . . . . . . . . . . . . . . 309
. . . . . . . . . . . . . . . . . . . . . . . . . 319
. . . . . . . . . . . . . . . . . . . . . . . . . 322
. . . . . . . . . . . . . . . . . . . . . . . . . 339
. . . . . . . . . . . . . . . . . . . . . . . . . 352
. . . . . . . . . . . . . . . . . . . . . . . . . 356
. . . . . . . . . . . . . . . . . . . . . . . . . 361

Generated by Doxygen

Chapter 4

Data Structure Documentation
4.1

DNS_HEADER Struct Reference

DNS header structure.

4.1.1

Detailed Description

DNS header structure.
The documentation for this struct was generated from the following file:

• tau_dnr.c

4.2

GNU_PACKED Struct Reference

Types for ETB control.

#include 

Data Fields
• UINT8 trnVehNo
vehicle sequence number within the train with vehicle 01 being the first vehicle in ETB reference direction 1 as defined
in IEC61375-2-5 value range: 0..63 a value of 0 indicates that this vehicle has been inserted by correction

• ANTIVALENT8 isLead
vehicle is leading

• UINT8 leadDir
vehicle leading direction 0 = not relevant 1 = leading direction 1 2 = leading direction 2

• UINT8 vehOrient
vehicle orientation 0 = not known (corrected vehicle) 1 = same as operational train direction 2 = inverse to operational
train direction

• TRDP_SHORT_VERSION_T version
telegram version information, main_version = 1, sub_version = 0

10

Data Structure Documentation

• UINT16 reserved01
reserved (=0)

• UINT8 trnCstNo
own TCN consist number (= 1..32)

• UINT8 reserved02
reserved (=0)

• UINT8 ownOpCstNo
own operational address (= 1..32) = 0 if unknown (e.g.

• UINT8 reserved03
reserved (=0)

• UINT32 cstTopoCount
Consist topology counter.

• UINT32 trnTopoCount
Train directory topology counter.

• UINT32 opTrnTopoCount
Operational Train topology counter.

• ANTIVALENT8 wasLead
consist was leading, '01'B = false, '10'B = true

• ANTIVALENT8 reqLead
leading request, '01'B = false, '10'B = true

• UINT8 reqLeadDir
(request) leading direction, '01'B = consist direction 1, '10'B = consist direction 2

• ANTIVALENT8 accLead
accept remote leading request, '01'B = false/not accepted, '10'B = true/accepted

• ANTIVALENT8 clearConfComp
clear confirmed composition, '01'B = false, '10'B = true

• ANTIVALENT8 corrRequest
request confirmation, '01'B = false, '10'B = true

• ANTIVALENT8 corrInfoSet
correction info set, '01'B = false, '10'B = true

• ANTIVALENT8 compStored
corrected composition stored, '01'B = false, '10'B = true

• ANTIVALENT8 sleepRequest
request sleep mode, '01'B = false, '10'B = true

• UINT8 leadVehOfCst
position of leading vehicle in consist, 0..31 (1: first vehicle in consist in Direction 1, 2: second vehicle, etc.)

• UINT8 reserved04
reserved (=0)

• UINT16 reserved05
reserved (=0)

• UINT8 reserved06
reserved (=0)

• UINT8 confVehCnt
number of confirmed vehicles in train (1..63)

• TRDP_CONF_VEHICLE_T confVehList [TRDP_MAX_VEH_CNT]
dynamic ordered list of confirmed vehicles in train, starting with vehicle at train head, see sub-clause 5.3.3.2.6

• TRDP_ETB_CTRL_VDP_T safetyTrail
ETBCTRL-VDP trailer, completely set to 0 == not used.

• UINT8 reserved01
reserved (=0)

• TRDP_NET_LABEL_T deviceName
Generated by Doxygen

4.2 GNU_PACKED Struct Reference

11

function device of ECSC which sends the telegram

• UINT8 inhibit
inauguration inhibit 0 = no inhibit request 1 = inhibit request

• UINT8 leadingReq
leading request 0 = no leading request 1 = leading request

• UINT8 leadingDir
leading direction 0 = no leading request 1 = leading request direction 1 2 = leading request direction 2

• UINT8 sleepReq
sleep request 0 = no sleep request 1 = sleep request

• UINT16 lifesign
wrap-around counter, incremented with each produced datagram.

• UINT8 ecspState
ECSP state indication 0 = ECSP not operational(initial value) 1 = ECSP in operation.

• UINT8 etbInhibit
inauguration inhibit indication 0 = n/a (default) 1 = inhibit not requested on ETB 2 = inhibit set on local ETBN 3 = inhibit
set on remote ETBN 4 = inhibit set on local and remote ETBN

• UINT8 etbLength
indicates train lengthening in case train inauguration is inhibit 0 = no lengthening (default) 1 = lengthening detected

• UINT8 etbShort
indicates train shortening in case train inauguration is inhibit 0 = no shortening (default) 1 = shortening detected

• UINT16 reserved02
reserved (=0)

• UINT8 etbLeadState
indication of local consist leadership 5 = consist not leading (initial value) 6 = consist is leading requesting 9 = consist
is leading 10 = leading conflict other values are not allowed

• UINT8 etbLeadDir
direction of the leading end car in the local consist 0 = unknown (default) 1 = TCN direction 1 2 = TCN direction 2
other values are not allowed

• UINT8 ttdbSrvState
TTDB server state indication 0 = n/a (initial value) 1 = Leader (default) 2 = Follower 3 = Error.

• UINT8 dnsSrvState
DNS server state indication 0 = n/a (initial value) 1 = Leader (default) 2 = Follower 3 = Error.

• UINT8 trnDirState
train directory state 1 = UNCONFIRMED 2 = CONFIRMED other values are not allowed

• UINT8 opTrnDirState
train directory state 1 = INVALID 2 = VALID 4 = SHARED other values are not allowed

• UINT8 sleepCtrlState
sleep control state (option) 0 = option not available 1 = RegularOperation 2 = WaitForSleepMode 3 = PrepareFor←SleepMode

• UINT8 sleepReqCnt
number of sleep requests (option) value range: 0..63, not used = 0

• UINT32 opTrnTopoCnt
operational train topology counter

• UINT8 command
confirmation order 1 = confirmation/correction request 2 = un-confirmation request

• UINT16 confVehCnt
number of confirmed vehicles in the train (1..63).

• TRDP_OP_VEHICLE_T confVehList [TRDP_MAX_VEH_CNT]
ordered list of confirmed vehicles in the train, starting with vehicle at train head, see chapter 5.3.3.2.10.

• UINT8 status
status of storing correction info 0 = correctly stored 1 = not stored

Generated by Doxygen

12

Data Structure Documentation

• UINT32 reqSafetyCode
SC-32 value of the request message.

• UINT8 byPassCtrl
ETBN bypass control 0 = no action (keep old state) 1 = no bypass 2 = activate bypass.

• UINT8 txCtrl
ETBN transmission control 0 = no action (keep old state) 1 = activate sending on ETB (default) 2 = stop sending on
ETB.

• UINT8 slCtrl
sleep mode control (option) 0 = no action (keep old state) 1 = deactivate sleep mode 2 = activate sleep mode (line
activity sensing)

• UINT8 etbnState
state indication of the (active) ETBN 0 = ETBN not operational(initial value) 1 = ETBN in operation

• UINT8 etbnInaugState
ETBN inauguration state as defined in IEC61375-2-5 0 = init 1 = not inaugurated 2 = inaugurated 3 = ready for
inauguration.

• UINT8 etbnPosition
position of the ETBN 0 = unknown (default) 1 = single node 2 = middle node 3 = end node TCN direction 1 4 = end
node TCN direction 2

• UINT8 etbnRole
ETBN node role as defined in IEC61375-2-5 0 = undefined 1 = master (redundancy leader) 2 = backup (redundancy
follower) 3 = not redundant.

• BITSET8 etbLineState
indication of ETB line status (FALSE == not trusted, TRUE == trusted) bit0 = line A ETBN direction 1 bit1 = line B
ETBN direction 1 bit2 = line C ETBN direction 1 bit3 = line D ETBN direction 1 bit4 = line A ETBN direction 2 bit5 =
line B ETBN direction 2 bit6 = line C ETBN direction 2 bit7 = line D ETBN direction 2

• UINT8 byPassState
state of bypass function 0 = bypass disabled 1 = bypass enabled

• UINT8 slState
sleep mode state (option) 0 = no sleep mode 1 = sleep mode active (line activity sensing)

• UINT32 etbTopoCnt
ETB topography counter.

• TRDP_TRAIN_NET_DIR_T trnNetDir
dynamic train info

• UINT8 ver
Version - incremented for incompatible changes.

• UINT8 rel
Release - incremented for compatible changes.

• UINT32 reserved01
reserved (=0)

• TRDP_SHORT_VERSION_T userDataVersion
version of the vital ETBCTRL telegram mainVersion = 1, subVersion = 0

• UINT32 safeSeqCount
safe sequence counter, as defined in B.9

• UINT32 safetyCode
checksum, as defined in B.9

• TRDP_UUID_T cstUUID
UUID of the consist, provided by ETBN (TrainNetworkDirectory) Reference to static consist attributes 0 if not available
(e.g.

• UINT32 cstTopoCnt
consist topology counter provided with the CSTINFO 0 if no CSTINFO available

• UINT8 cstOrient
consist orientation '01'B = same as train direction '10'B = inverse to train direction
Generated by Doxygen

4.2 GNU_PACKED Struct Reference

13

• UINT8 cstCnt
number of consists in train; range: 1..63

• TRDP_CONSIST_T cstList [TRDP_MAX_CST_CNT]
consist list.

• UINT32 trnTopoCnt
trnTopoCnt value ctrlType == 0: actual value ctrlType == 1: set to 0

• UINT8 etbId
identification of the ETB the TTDB is computed for bit0: ETB0 (operational network) bit1: ETB1 (multimedia network)
bit2: ETB2 (other network) bit3: ETB3 (other network)

• TRDP_NET_LABEL_T vehId
Unique vehicle identifier, application defined (e.g.

• UINT8 opVehNo
operational vehicle sequence number in train value range 1..63

• UINT8 opCstNo
operational consist number in train (1..63)

• UINT8 opCstOrient
consist orientation '00'B = not known (corrected vehicle) '01'B = same as operational train direction '10'B = inverse to
operational train direction

• TRDP_NET_LABEL_T trnId
train identifier, application defined (e.g.

• TRDP_NET_LABEL_T trnOperator
train operator, e.g.

• UINT32 crc
sc-32 computed over record (seed value: 'FFFFFFFF'H)

• UINT8 opTrnOrient
operational train orientation '00'B = unknown '01'B = same as train direction '10'B = inverse to train direction

• UINT8 opCstCnt
number of consists in train (1..63)

• TRDP_OP_CONSIST_T opCstList [TRDP_MAX_CST_CNT]
operational consist list starting with op.

• UINT8 reserved05
reserved for future use (= 0)

• UINT8 opVehCnt
number of vehicles in train (1..63)

• TRDP_OP_VEHICLE_T opVehList [TRDP_MAX_VEH_CNT]
operational vehicle list starting with op.

• TRDP_OP_TRAIN_DIR_STATE_T state
operational state of the train

• UINT32 cstNetProp
consist network properties bit0..1: consist orientation bit2..7: 0 bit8..13: ETBN Id bit14..15: 0 bit16..21: subnet Id
bit24..29: CN Id bit30..31: 0

• UINT16 entryCnt
number of entries in train network directory

• TRDP_TRAIN_NET_DIR_ENTRY_T trnNetDir [TRDP_MAX_CST_CNT]
train network directory

• TRDP_OP_TRAIN_DIR_T opTrnDir
operational directory

• TRDP_TRAIN_DIR_T trnDir
train directory

• UINT32 sequenceCounter
Unique counter (autom incremented)

Generated by Doxygen

14

Data Structure Documentation

• UINT16 protocolVersion
fix value for compatibility (set by the API)

• UINT16 msgType
of datagram: PD Request (0x5072) or PD_MSG (0x5064)

• UINT32 comId
set by user: unique id

• UINT32 datasetLength
length of the data to transmit 0...1432

• UINT32 reserved
before used for ladder support

• UINT32 replyComId
used in PD request

• UINT32 replyIpAddress
used for PD request

• UINT32 frameCheckSum
CRC32 of header.

• INT32 replyStatus
0 = OK

• UINT8 sessionID [16u]
UUID as a byte stream.

• UINT32 replyTimeout
in us

• UINT8 sourceURI [32u]
User part of URI.

• UINT8 destinationURI [32u]
User part of URI.

• PD_HEADER_T frameHead
Packet header in network byte order.

• UINT8 data [TRDP_MAX_PD_DATA_SIZE]
data ready to be sent or received (with CRCs)

4.2.1

Detailed Description

Types for ETB control.
TRDP PD packet.
TRDP message data header - network order and alignment.
TRDP process data header - network order and alignment.
Complete TTDB structure.
Train network directory structure.
Train network directory entry structure acc.
Operational Train directory status info structure.
Operational train structure.
Operational train directory state.
Generated by Doxygen

4.2 GNU_PACKED Struct Reference

15

Operational consist structure.
Operational vehicle structure.
TCN train directory.
CSTINFO Control telegram.
TCN consist structure.
Version information for communication buffers.
to IEC61375-2-5

4.2.2

Field Documentation

4.2.2.1

confVehCnt

UINT16 GNU_PACKED::confVehCnt

number of confirmed vehicles in the train (1..63).

4.2.2.2

confVehList

TRDP_OP_VEHICLE_T GNU_PACKED::confVehList[TRDP_MAX_VEH_CNT]

ordered list of confirmed vehicles in the train, starting with vehicle at train head, see chapter 5.3.3.2.10.
Parameters 'isLead' and 'leadDir' to be set to 0

4.2.2.3

cstList

TRDP_CONSIST_T GNU_PACKED::cstList

consist list.
consist list ordered list starting with trnCstNo == 1 Note: This is a variable size array, only opCstCnt array elements
are present on the network and for crc computation
If trnCstNo > 0 this shall be an ordered list starting with trnCstNo == 1 (exactly the same as in structure TRAIN←_DIRECTORY). If trnCstNo == 0 it is not mandatory to list all consists (only consists which should send CSTINFO
telegram). The parameters 'trnCstNo' and 'cstOrient' are optional and can be set to 0.
Generated by Doxygen

16

4.2.2.4

Data Structure Documentation

cstUUID

TRDP_UUID_T GNU_PACKED::cstUUID

UUID of the consist, provided by ETBN (TrainNetworkDirectory) Reference to static consist attributes 0 if not available (e.g.
unique consist identifier
Reference to static consist attributes, 0 if not available (e.g.
correction)

4.2.2.5

datasetLength

UINT32 GNU_PACKED::datasetLength

length of the data to transmit 0...1432
defined by user: length of data to transmit

4.2.2.6

deviceName

TRDP_NET_LABEL_T GNU_PACKED::deviceName

function device of ECSC which sends the telegram
function device of ED which sends the telegram

4.2.2.7

etbId

UINT8 GNU_PACKED::etbId

identification of the ETB the TTDB is computed for bit0: ETB0 (operational network) bit1: ETB1 (multimedia network)
bit2: ETB2 (other network) bit3: ETB3 (other network)
identification of the ETB the TTDB is computed for 0: ETB0 (operational network) 1: ETB1 (multimedia network) 2:
ETB2 (other network) 3: ETB3 (other network)

4.2.2.8

etbTopoCnt

UINT32 GNU_PACKED::etbTopoCnt

ETB topography counter.
set by user: ETB to use, '0' for consist local traffic
train network directory CRC
Generated by Doxygen

4.2 GNU_PACKED Struct Reference

4.2.2.9

17

inhibit

UINT8 GNU_PACKED::inhibit

inauguration inhibit 0 = no inhibit request 1 = inhibit request
ETBN inhibit 0 = no action (keep old state) 1 = no inhibit request 2 = inhibit request.

4.2.2.10

isLead

ANTIVALENT8 GNU_PACKED::isLead

vehicle is leading
consist contains leading vehicle, '01'B = false, '10'B = true

4.2.2.11

leadDir

UINT8 GNU_PACKED::leadDir

vehicle leading direction 0 = not relevant 1 = leading direction 1 2 = leading direction 2
'vehicle leading direction 0 = not relevant 1 = leading direction 1 2 = leading direction 2

4.2.2.12

leadVehOfCst

UINT8 GNU_PACKED::leadVehOfCst

position of leading vehicle in consist, 0..31 (1: first vehicle in consist in Direction 1, 2: second vehicle, etc.)
position of leading vehicle in consist range 0...32 0 = not defined 1 = first vehicle in consist in direction 1 2 = second
vehicle etc.

4.2.2.13

lifesign

UINT16 GNU_PACKED::lifesign

wrap-around counter, incremented with each produced datagram.

4.2.2.14

msgType

UINT16 GNU_PACKED::msgType

of datagram: PD Request (0x5072) or PD_MSG (0x5064)
of datagram: Mn, Mr, Mp, Mq, Mc or Me
Generated by Doxygen

18

4.2.2.15

Data Structure Documentation

opCstList

TRDP_OP_CONSIST_T GNU_PACKED::opCstList[TRDP_MAX_CST_CNT]

operational consist list starting with op.
consist #1 Note: This is a variable size array, only opCstCnt array elements are present

4.2.2.16

opTrnDirState

UINT8 GNU_PACKED::opTrnDirState

train directory state 1 = INVALID 2 = VALID 4 = SHARED other values are not allowed
Operational train directory status: '01'B == invalid, '10'B == valid, '100'B == shared.

4.2.2.17

opTrnTopoCnt

UINT32 GNU_PACKED::opTrnTopoCnt

operational train topology counter
set by user: direction/side critical, '0' if ignored
operational train topology counter computed as defined in 5.3.3.2.16 (seed value : trnTopoCnt)
operational train topology counter set to 0 if opTrnDirState == invalid
operational train topocounter value of the operational train directory the correction is based on

4.2.2.18

opVehList

TRDP_OP_VEHICLE_T GNU_PACKED::opVehList[TRDP_MAX_VEH_CNT]

operational vehicle list starting with op.
vehicle #1 Note: This is a variable size array, only opCstCnt array elements are present

4.2.2.19

ownOpCstNo

UINT8 GNU_PACKED::ownOpCstNo

own operational address (= 1..32) = 0 if unknown (e.g.
operational consist number the vehicle belongs to
after Inauguration)
Generated by Doxygen

4.2 GNU_PACKED Struct Reference

4.2.2.20

protocolVersion

UINT16 GNU_PACKED::protocolVersion

fix value for compatibility (set by the API)
fix value for compatibility

4.2.2.21

reserved01 [1/2]

UINT16 GNU_PACKED::reserved01

reserved (=0)
reserved for future use (= 0)

4.2.2.22

reserved01 [2/2]

UINT8 GNU_PACKED::reserved01

reserved (=0)
reserved for future use (= 0)

4.2.2.23

reserved02 [1/2]

UINT16 GNU_PACKED::reserved02

reserved (=0)
reserved (= 0)
reserved for future use (= 0)

4.2.2.24

reserved02 [2/2]

UINT16 GNU_PACKED::reserved02

reserved (=0)
reserved (= 0)

4.2.2.25

reserved03

UINT8 GNU_PACKED::reserved03

reserved (=0)
reserved for future use (= 0)
Generated by Doxygen

19

20

4.2.2.26

Data Structure Documentation

reserved04

UINT8 GNU_PACKED::reserved04

reserved (=0)
reserved for future use (= 0)

4.2.2.27

reserved06

UINT8 GNU_PACKED::reserved06

reserved (=0)
reserved for future use (= 0)

4.2.2.28

safetyTrail

TRDP_ETB_CTRL_VDP_T GNU_PACKED::safetyTrail

ETBCTRL-VDP trailer, completely set to 0 == not used.
ETBCTRL-VDP trailer, parameter 'safeSequCount' == 0 completely set to 0 == not used.
ETBCTRL-VDP trailer, parameter 'safeSequCount' == 0 completely set to 0 == SDTv2 not used.
ETBCTRL-VDP trailer, completely set to 0 == SDTv2 not used.

4.2.2.29

trnCstNo

UINT8 GNU_PACKED::trnCstNo

own TCN consist number (= 1..32)
sequence number of consist in train with vehicle 01 being the first vehicle in ETB reference direction 1 as defined in
IEC61375-2-5, value range: 1..63, 0 = inserted by correction
train consist number telegram control type 0 = with trnTopoCnt tracking 1 = without trnTopoCnt tracking
Sequence number of consist in train (1..63)

4.2.2.30

trnDirState

UINT8 GNU_PACKED::trnDirState

train directory state 1 = UNCONFIRMED 2 = CONFIRMED other values are not allowed
TTDB status: '01'B == unconfirmed, '10'B == confirmed.
Generated by Doxygen

4.2 GNU_PACKED Struct Reference

4.2.2.31

21

trnId

TRDP_NET_LABEL_T GNU_PACKED::trnId

train identifier, application defined (e.g.
'ICE75', 'IC346'), informal

4.2.2.32

trnNetDir

TRDP_TRAIN_NET_DIR_T GNU_PACKED::trnNetDir

dynamic train info
network directory

4.2.2.33

trnOperator

TRDP_NET_LABEL_T GNU_PACKED::trnOperator

train operator, e.g.
'trenitalia.it', informal

4.2.2.34

trnTopoCnt

UINT32 GNU_PACKED::trnTopoCnt

trnTopoCnt value ctrlType == 0: actual value ctrlType == 1: set to 0
computed as defined in 5.3.3.2.16 (seed value: etbTopoCnt)

4.2.2.35

trnVehNo

UINT8 GNU_PACKED::trnVehNo

vehicle sequence number within the train with vehicle 01 being the first vehicle in ETB reference direction 1 as
defined in IEC61375-2-5 value range: 0..63 a value of 0 indicates that this vehicle has been inserted by correction
vehicle sequence number within the train with vehicle 01 being the first vehicle in ETB reference direction 1 as
defined in IEC61375-2-5, value range: 1..63, a value of 0 indicates that this vehicle has been inserted by correction

4.2.2.36

vehId

TRDP_NET_LABEL_T GNU_PACKED::vehId

Unique vehicle identifier, application defined (e.g.
UIC Identifier)
Generated by Doxygen

22

Data Structure Documentation

4.2.2.37

vehOrient

UINT8 GNU_PACKED::vehOrient

vehicle orientation 0 = not known (corrected vehicle) 1 = same as operational train direction 2 = inverse to operational
train direction
vehicle orientation, '00'B = not known (corrected vehicle) '01'B = same as operational train direction '10'B = inverse
to operational train direction

4.2.2.38

version

TRDP_SHORT_VERSION_T GNU_PACKED::version

telegram version information, main_version = 1, sub_version = 0
Train info structure version.
TrainDirectoryState data structure version parameter 'mainVersion' shall be set to 1.
TrainDirectory data structure version parameter 'mainVersion' shall be set to 1.
Consist Info Control structure version parameter 'mainVersion' shall be set to 1.
The documentation for this struct was generated from the following files:

• tau_ctrl_types.h
• tau_tti_types.h
• trdp_private.h

4.3

PD_ELE Struct Reference

Queue element for PD packets to send or receive.

#include 
Collaboration diagram for PD_ELE:

TRDP_SEND_PARAM_T

sendParam

sendParam
TRDP_SOCKETS

TRDP_SOCKET_TCP

tcpParams

iface
TRDP_MEM_CONFIG_T

TRDP_HANDLE

addr

pNext
PD_ELE

pCachedDS

memConfig

pNext

pSndQueue
pRcvQueue

TRDP_SESSION

pdDefault

TRDP_PD_CONFIG_T

pfCbFunction

pfCbFunction
marshall

TRDP_DATASET

pElement
pCachedDS
pfCbUnmarshall
pfCbMarshall

TRDP_DATASET_ELEMENT_T
stats
TRDP_MARSHALL_CONFIG_T

TRDP_MEM_STATISTICS_T

mem

TRDP_PD_STATISTICS_T

tcpMd
udpMd

pd

TRDP_STATISTICS_T

TRDP_MD_STATISTICS_T

Generated by Doxygen

4.3 PD_ELE Struct Reference

Data Fields
• struct PD_ELE ∗ pNext
pointer to next element or NULL

• UINT32 magic
prevent acces through dangeling pointer

• TRDP_ADDRESSES_T addr
handle of publisher/subscriber

• TRDP_IP_ADDR_T lastSrcIP
last source IP a subscribed packet was received from

• TRDP_IP_ADDR_T pullIpAddress
In case of pulling a PD this is the requested Ip.

• UINT32 redId
Redundancy group ID or zero.

• UINT32 curSeqCnt
the last sent or received sequence counter

• UINT32 curSeqCnt4Pull
the last sent sequence counter for PULL

• TRDP_SEQ_CNT_LIST_T ∗ pSeqCntList
pointer to list of received sequence numbers per comId

• UINT32 numRxTx
Counter for received packets (statistics)

• UINT32 updPkts
Counter for updated packets (statistics)

• UINT32 getPkts
Counter for read packets (statistics)

• UINT32 numMissed
Counter for skipped sequence number (statistics)

• TRDP_ERR_T lastErr
Last error (timeout)

• TRDP_PRIV_FLAGS_T privFlags
private flags

• TRDP_FLAGS_T pktFlags
flags

• TRDP_TIME_T interval
time out value for received packets or interval for packets to send (set from ms)

• TRDP_TIME_T timeToGo
next time this packet must be sent/rcv

• TRDP_TO_BEHAVIOR_T toBehavior
timeout behavior for packets

• UINT32 dataSize
net data size

• UINT32 grossSize
complete packet size (header, data)

• UINT32 sendSize
data size sent out

• TRDP_DATASET_T ∗ pCachedDS
Pointer to dataset element if known.

• INT32 socketIdx
index into the socket list

• const void ∗ pUserRef
Generated by Doxygen

23

24

Data Structure Documentation

from subscribe()

• TRDP_PD_CALLBACK_T pfCbFunction
Pointer to PD callback function.

• PD_PACKET_T ∗ pFrame
header ...

4.3.1

Detailed Description

Queue element for PD packets to send or receive.

4.3.2

Field Documentation

4.3.2.1

pFrame

PD_PACKET_T∗ PD_ELE::pFrame

header ...
data + FCS...
The documentation for this struct was generated from the following file:

• trdp_private.h

4.4

TAU_MARSHALL_INFO_T Struct Reference

Marshalling info, used to and from wire.

Data Fields
• INT32 level
track recursive level

• UINT8 ∗ pSrc
source pointer

• UINT8 ∗ pSrcEnd
last source

• UINT8 ∗ pDst
destination pointer

• UINT8 ∗ pDstEnd
last destination
Generated by Doxygen

4.5 TCN_URI Struct Reference

4.4.1

Detailed Description

Marshalling info, used to and from wire.
The documentation for this struct was generated from the following file:
• tau_marshall.c

4.5

TCN_URI Struct Reference

TCN-DNS simplified header structures.

#include 

Data Fields
• CHAR8 tcnUriStr [80]
if != 0 use TCN DNS as resolver

• INT16 resolvState
on request: reserved (= 0), on reply: -1 unknown, 0 OK

• UINT32 tcnUriIpAddr
IP address of URI.

• UINT32 tcnUriIpAddr2
if != 0, end IP address of range

4.5.1

Detailed Description

TCN-DNS simplified header structures.
The documentation for this struct was generated from the following file:
• tau_dnr_types.h

4.6

TRDP_CLTR_CST_INFO_T Struct Reference

Closed train consists information.

#include 

Data Fields
• TRDP_UUID_T cltrCstUUID
closed train consist UUID

• UINT8 cltrCstOrient
closed train consist orientation '01'B = same as closed train direction '10'B = inverse to closed train direction

• UINT8 cltrCstNo
sequence number of the consist within the closed train, value range 1..32

• UINT16 reserved01
reserved for future use (= 0)
Generated by Doxygen

25

26

Data Structure Documentation

4.6.1

Detailed Description

Closed train consists information.
The documentation for this struct was generated from the following file:
• tau_tti_types.h

4.7

TRDP_COMID_DSID_MAP_T Struct Reference

ComId - data set mapping element definition.

#include 

Data Fields
• UINT32 comId
comId

• UINT32 datasetId
corresponding dataset Id

4.7.1

Detailed Description

ComId - data set mapping element definition.
The documentation for this struct was generated from the following file:
• trdp_types.h

4.8

TRDP_CONSIST_INFO_T Struct Reference

consist information structure

#include 
Collaboration diagram for TRDP_CONSIST_INFO_T:

TRDP_FUNCTION_INFO_T
pFctInfoList
TRDP_CLTR_CST_INFO_T

pCltrCstInfoList
TRDP_CONSIST_INFO_T

cstProp
TRDP_PROP_T

pVehInfoList

vehProp
TRDP_VEHICLE_INFO_T

pEtbInfoList

TRDP_ETB_INFO_T

Generated by Doxygen

4.8 TRDP_CONSIST_INFO_T Struct Reference

Data Fields
• TRDP_SHORT_VERSION_T version
ConsistInfo data structure version, application defined mainVersion = 1, subVersion = 0.

• UINT8 cstClass
consist info classification 1 = (single) consist 2 = closed train 3 = closed train consist

• UINT8 reserved01
reserved for future use (= 0)

• TRDP_NET_LABEL_T cstId
application defined consist identifier, e.g.

• TRDP_NET_LABEL_T cstType
consist type, application defined

• TRDP_NET_LABEL_T cstOwner
consist owner, e.g.

• TRDP_UUID_T cstUUID
consist UUID

• UINT32 reserved02
reserved for future use (= 0)

• TRDP_PROP_T cstProp
static consist properties

• UINT16 reserved03
reserved for future use (= 0)

• UINT16 etbCnt
number of ETB's, range: 1..4

• TRDP_ETB_INFO_T ∗ pEtbInfoList
ETB information list for the consist Ordered list starting with lowest etbId.

• UINT16 reserved04
reserved for future use (= 0)

• UINT16 vehCnt
number of vehicles in consist 1..32

• TRDP_VEHICLE_INFO_T ∗ pVehInfoList
vehicle info list for the vehicles in the consist Ordered list starting with cstVehNo==1

• UINT16 reserved05
reserved for future use (= 0)

• UINT16 fctCnt
number of consist functions value range 0..1024

• TRDP_FUNCTION_INFO_T ∗ pFctInfoList
function info list for the functions in consist lexicographical ordered by fctName

• UINT16 reserved06
reserved for future use (= 0)

• UINT16 cltrCstCnt
number of original consists in closed train value range: 0..32, 0 = consist is no closed train

• TRDP_CLTR_CST_INFO_T ∗ pCltrCstInfoList
info on closed train composition Ordered list starting with cltrCstNo == 1

• UINT32 cstTopoCnt
consist topology counter computed as defined in 5.3.3.2.16, seed value: 'FFFFFFFF'H

4.8.1

Detailed Description

consist information structure
Generated by Doxygen

27

28

Data Structure Documentation

4.8.2

Field Documentation

4.8.2.1

cstId

TRDP_NET_LABEL_T TRDP_CONSIST_INFO_T::cstId

application defined consist identifier, e.g.
UIC identifier

4.8.2.2

cstOwner

TRDP_NET_LABEL_T TRDP_CONSIST_INFO_T::cstOwner

consist owner, e.g.
"trenitalia.it", "sncf.fr", "db.de"
The documentation for this struct was generated from the following file:

• tau_tti_types.h

4.9

TRDP_DATASET Struct Reference

Dataset definition.

#include 
Collaboration diagram for TRDP_DATASET:

TRDP_DATASET
pCachedDS pElement
TRDP_DATASET_ELEMENT_T

Generated by Doxygen

4.10 TRDP_DATASET_ELEMENT_T Struct Reference

Data Fields
• UINT32 id
dataset identifier > 1000

• UINT16 reserved1
Reserved for future use, must be zero.

• UINT16 numElement
Number of elements.

• TRDP_DATASET_ELEMENT_T pElement [ ]
Pointer to a dataset element, used as array.

4.9.1

Detailed Description

Dataset definition.

The documentation for this struct was generated from the following file:

• trdp_types.h

4.10

TRDP_DATASET_ELEMENT_T Struct Reference

Dataset element definition.

#include 

Collaboration diagram for TRDP_DATASET_ELEMENT_T:

TRDP_DATASET_ELEMENT_T
pElement pCachedDS
TRDP_DATASET

Generated by Doxygen

29

30

Data Structure Documentation

Data Fields
• UINT32 type
Data type (TRDP_DATA_TYPE_T 1...99) or dataset id > 1000.

• UINT32 size
Number of items or TRDP_VAR_SIZE (0)

• CHAR8 ∗ name
Name param, on special request (Ticket #211)

• CHAR8 ∗ unit
Unit text for visualisation.

• REAL32 scale
Factor for visualisation.

• INT32 offset
Offset for visualisation (val = scale ∗ x + offset)
• struct TRDP_DATASET ∗ pCachedDS
Used internally for marshalling speed-up.

4.10.1

Detailed Description

Dataset element definition.
The documentation for this struct was generated from the following file:
• trdp_types.h

4.11

TRDP_DBG_CONFIG_T Struct Reference

Control for debug output device/file on application level.

#include 

Data Fields
• TRDP_DBG_OPTION_T option
Debug printout options for application use.

• UINT32 maxFileSize
Maximal file size.

• TRDP_FILE_NAME_T fileName
Debug file name and path.

4.11.1

Detailed Description

Control for debug output device/file on application level.
The documentation for this struct was generated from the following file:
• tau_xml.h
Generated by Doxygen

4.12 TRDP_DNS_REPLY Struct Reference

4.12

31

TRDP_DNS_REPLY Struct Reference

TCN-DNS Reply telegram TCN_DNS_REP_DS.

#include 
Collaboration diagram for TRDP_DNS_REPLY:

TCN_URI
tcnUriList
TRDP_DNS_REPLY

Data Fields
• TRDP_SHORT_VERSION_T version
1.0

• TRDP_NET_LABEL_T deviceName
function device of ED which sends the telegram

• UINT32 etbTopoCnt
ETB topography counter.

• UINT32 opTrnTopoCnt
operational train topography counter needed for TCN-URIs related to the operational train view = 0 if not used

• UINT8 etbId
identification of the related ETB 0 = ETB0 (operational network) 1 = ETB1 (multimedia network) 2 = ETB2 (other
network) 3 = ETB3 (other network) 255 = don’t care (for access to local DNS server)

• INT8 dnsStatus
0 = OK -1 = DNS Server not ready -2 = Inauguration in progress

• UINT8 tcnUriCnt
number of TCN-URIs to be resolved value range: 0 .

• TCN_URI_T tcnUriList [255]
defined for max size

• TRDP_ETB_CTRL_VDP_T safetyTrail
SDT trailer.

4.12.1

Detailed Description

TCN-DNS Reply telegram TCN_DNS_REP_DS.
Generated by Doxygen

32

Data Structure Documentation

4.12.2

Field Documentation

4.12.2.1

tcnUriCnt

UINT8 TRDP_DNS_REPLY::tcnUriCnt

number of TCN-URIs to be resolved value range: 0 .
. 255
The documentation for this struct was generated from the following file:
• tau_dnr_types.h

4.13

TRDP_DNS_REQUEST Struct Reference

TCN-DNS Request telegram TCN_DNS_REQ_DS.

#include 
Collaboration diagram for TRDP_DNS_REQUEST:

TCN_URI
tcnUriList
TRDP_DNS_REQUEST

Data Fields
• TRDP_SHORT_VERSION_T version
1.0

• TRDP_NET_LABEL_T deviceName
function device of ED which sends the telegram

• UINT32 etbTopoCnt
ETB topography counter.

• UINT32 opTrnTopoCnt
operational train topography counter needed for TCN-URIs related to the operational train view = 0 if not used

• UINT8 etbId
identification of the related ETB 0 = ETB0 (operational network) 1 = ETB1 (multimedia network) 2 = ETB2 (other
network) 3 = ETB3 (other network) 255 = don’t care (for access to local DNS server)

• UINT8 tcnUriCnt
number of TCN-URIs to be resolved value range: 0 .

• TCN_URI_T tcnUriList [255]
defined for max size

• TRDP_ETB_CTRL_VDP_T safetyTrail
SDT trailer.
Generated by Doxygen

4.14 TRDP_ETB_INFO_T Struct Reference

4.13.1

Detailed Description

TCN-DNS Request telegram TCN_DNS_REQ_DS.

4.13.2

Field Documentation

4.13.2.1

tcnUriCnt

UINT8 TRDP_DNS_REQUEST::tcnUriCnt

number of TCN-URIs to be resolved value range: 0 .
. 255
The documentation for this struct was generated from the following file:

• tau_dnr_types.h

4.14

TRDP_ETB_INFO_T Struct Reference

Types for train configuration information.

#include 

Data Fields
• UINT8 etbId
identification of train backbone; value range: 0..3

• UINT8 cnCnt
number of CNs within consist connected to this ETB value range 1..16 referring to cnId 0..15 acc.

• UINT16 reserved01
reserved for future use (= 0)

4.14.1

Detailed Description

Types for train configuration information.
ETB information

4.14.2

Field Documentation

Generated by Doxygen

33

34

Data Structure Documentation

4.14.2.1

cnCnt

UINT8 TRDP_ETB_INFO_T::cnCnt

number of CNs within consist connected to this ETB value range 1..16 referring to cnId 0..15 acc.
IEC61375-2-5
The documentation for this struct was generated from the following file:

• tau_tti_types.h

4.15

TRDP_FUNCTION_INFO_T Struct Reference

function/device information structure

#include 

Data Fields
• TRDP_NET_LABEL_T fctName
function device or group label

• UINT16 fctId
host identification of the function device or group as defined in IEC 61375-2-5, application defined.

• BOOL8 grp
is a function group and will be resolved as IP multicast address

• UINT8 reserved01
reserved for future use (= 0)

• UINT8 cstVehNo
Sequence number of the vehicle in the consist the function belongs to.

• UINT8 etbId
number of connected train backbone.

• UINT8 cnId
identifier of connected consist network in the consist, related to the etbId.

• UINT8 reserved02
reserved for future use (= 0)

4.15.1

Detailed Description

function/device information structure

4.15.2

Field Documentation

Generated by Doxygen

4.16 TRDP_HANDLE Struct Reference

4.15.2.1

cnId

UINT8 TRDP_FUNCTION_INFO_T::cnId

identifier of connected consist network in the consist, related to the etbId.
Value range: 0..31

4.15.2.2

cstVehNo

UINT8 TRDP_FUNCTION_INFO_T::cstVehNo

Sequence number of the vehicle in the consist the function belongs to.
Value range: 1..16, 0 = not defined

4.15.2.3

etbId

UINT8 TRDP_FUNCTION_INFO_T::etbId

number of connected train backbone.
Value range: 0..3

4.15.2.4

fctId

UINT16 TRDP_FUNCTION_INFO_T::fctId

host identification of the function device or group as defined in IEC 61375-2-5, application defined.
Value range: 1..16383 (device), 256..16383 (group)
The documentation for this struct was generated from the following file:

• tau_tti_types.h

4.16

TRDP_HANDLE Struct Reference

Hidden handle definition, used as unique addressing item.

#include 
Generated by Doxygen

35

36

Data Structure Documentation

Data Fields
• UINT32 comId
comId for packets to send/receive

• TRDP_IP_ADDR_T srcIpAddr
source IP for PD/MD

• TRDP_IP_ADDR_T srcIpAddr2
second source IP for PD/MD

• TRDP_IP_ADDR_T destIpAddr
destination IP for PD

• TRDP_IP_ADDR_T mcGroup
multicast group to join for PD

• UINT32 etbTopoCnt
etb topocount belongs to addressing item

• UINT32 opTrnTopoCnt
opTrn topocount belongs to addressing item

4.16.1

Detailed Description

Hidden handle definition, used as unique addressing item.
The documentation for this struct was generated from the following file:

• trdp_private.h

4.17

TRDP_LIST_STATISTICS_T Struct Reference

Information about a particular MD listener.

#include 

Data Fields
• UINT32 comId
ComId to listen to.

• TRDP_URI_USER_T uri
URI user part to listen to.

• TRDP_IP_ADDR_T joinedAddr
Joined IP address.

• UINT32 callBack
Call back function if used.

• UINT32 userRef
User reference if used.

• UINT32 numSessions
Number of sessions.
Generated by Doxygen

4.18 TRDP_MARSHALL_CONFIG_T Struct Reference

4.17.1

37

Detailed Description

Information about a particular MD listener.
The documentation for this struct was generated from the following file:

• trdp_types.h

4.18

TRDP_MARSHALL_CONFIG_T Struct Reference

Marshaling/unmarshalling configuration.

#include 
Collaboration diagram for TRDP_MARSHALL_CONFIG_T:

TRDP_DATASET
pfCbUnmarshall
pfCbMarshall
TRDP_MARSHALL_CONFIG_T

pCachedDS

TRDP_DATASET_ELEMENT_T

Data Fields
• TRDP_MARSHALL_T pfCbMarshall
Pointer to marshall callback function.

• TRDP_UNMARSHALL_T pfCbUnmarshall
Pointer to unmarshall callback function.

• void ∗ pRefCon
Pointer to user context for call back.

4.18.1

Detailed Description

Marshaling/unmarshalling configuration.
The documentation for this struct was generated from the following file:

• trdp_types.h
Generated by Doxygen

pElement

38

Data Structure Documentation

4.19

TRDP_MD_CONFIG_T Struct Reference

Default MD configuration.

#include 
Collaboration diagram for TRDP_MD_CONFIG_T:

sendParam
pfCbFunction

TRDP_PD_CONFIG_T

sendParam

TRDP_SEND_PARAM_T

pdDefault
sendParam
TRDP_MD_CONFIG_T
tcpParams

TRDP_SOCKET_TCP

TRDP_MD_STATISTICS_T

tcpMd
udpMd
mem

TRDP_MEM_STATISTICS_T

pd

pfCbFunction

TRDP_SOCKETS

TRDP_STATISTICS_T

TRDP_MEM_CONFIG_T

iface

pNext

stats
memConfig

TRDP_SESSION

pSndQueue
pRcvQueue
pNext
pfCbFunction

marshall

PD_ELE
TRDP_HANDLE

TRDP_PD_STATISTICS_T

pfCbUnmarshall
pfCbMarshall

TRDP_DATASET

pElement
pCachedDS

addr

TRDP_MARSHALL_CONFIG_T

TRDP_DATASET_ELEMENT_T

pCachedDS

Data Fields
• TRDP_MD_CALLBACK_T pfCbFunction
Pointer to MD callback function.

• void ∗ pRefCon
Pointer to user context for call back.

• TRDP_SEND_PARAM_T sendParam
Default send parameters.

• TRDP_FLAGS_T flags
Default flags for MD packets.

• UINT32 replyTimeout
Default reply timeout in us.

• UINT32 confirmTimeout
Default confirmation timeout in us.

• UINT32 connectTimeout
Default connection timeout in us.

• UINT32 sendingTimeout
Default sending timeout in us.

• UINT16 udpPort
Port to be used for UDP MD communication.

• UINT16 tcpPort
Port to be used for TCP MD communication.

• UINT32 maxNumSessions
Maximal number of replier sessions.
Generated by Doxygen

4.20 TRDP_MD_INFO_T Struct Reference

4.19.1

Detailed Description

Default MD configuration.
The documentation for this struct was generated from the following file:

• trdp_types.h

4.20

TRDP_MD_INFO_T Struct Reference

Message data info from received telegram; allows the application to generate responses.

#include 

Data Fields
• TRDP_IP_ADDR_T srcIpAddr
source IP address for filtering

• TRDP_IP_ADDR_T destIpAddr
destination IP address for filtering

• UINT32 seqCount
sequence counter

• UINT16 protVersion
Protocol version.

• TRDP_MSG_T msgType
Protocol ('PD', 'MD', ...)

• UINT32 comId
ComID.

• UINT32 etbTopoCnt
received topocount

• UINT32 opTrnTopoCnt
received topocount

• BOOL8 aboutToDie
session is about to die

• UINT32 numRepliesQuery
number of ReplyQuery received

• UINT32 numConfirmSent
number of Confirm sent

• UINT32 numConfirmTimeout
number of Confirm Timeouts (incremented by listeners

• UINT16 userStatus
error code, user stat

• TRDP_REPLY_STATUS_T replyStatus
reply status

• TRDP_UUID_T sessionId
for response

• UINT32 replyTimeout
reply timeout in us given with the request

Generated by Doxygen

39

40

Data Structure Documentation

• TRDP_URI_USER_T srcUserURI
source URI user part from MD header

• TRDP_URI_HOST_T srcHostURI
source URI host part (unused)

• TRDP_URI_USER_T destUserURI
destination URI user part from MD header

• TRDP_URI_HOST_T destHostURI
destination URI host part (unused)

• UINT32 numExpReplies
number of expected replies, 0 if unknown

• UINT32 numReplies
actual number of replies for the request

• const void ∗ pUserRef
User reference given with the local call.

• TRDP_ERR_T resultCode
error code

4.20.1

Detailed Description

Message data info from received telegram; allows the application to generate responses.
Note: Not all fields are relevant for each message type!
The documentation for this struct was generated from the following file:

• trdp_types.h

4.21

TRDP_MD_STATISTICS_T Struct Reference

Structure containing all general MD statistics information.

#include 

Data Fields
• UINT32 defQos
default QoS for MD

• UINT32 defTtl
default TTL for MD

• UINT32 defReplyTimeout
default reply timeout in us for MD

• UINT32 defConfirmTimeout
default confirm timeout in us for MD

• UINT32 numList
number of listeners

• UINT32 numRcv
number of received MD packets

• UINT32 numCrcErr
Generated by Doxygen

4.22 TRDP_MEM_CONFIG_T Struct Reference

number of received MD packets with CRC err

• UINT32 numProtErr
number of received MD packets with protocol err

• UINT32 numTopoErr
number of received MD packets with wrong topo count

• UINT32 numNoListener
number of received MD packets without listener

• UINT32 numReplyTimeout
number of reply timeouts

• UINT32 numConfirmTimeout
number of confirm timeouts

• UINT32 numSend
number of sent MD packets

4.21.1

Detailed Description

Structure containing all general MD statistics information.
The documentation for this struct was generated from the following file:

• trdp_types.h

4.22

TRDP_MEM_CONFIG_T Struct Reference

Enumeration type for memory pre-fragmentation, reuse of VOS definition.

#include 

Data Fields
• UINT8 ∗ p
pointer to static or allocated memory

• UINT32 size
size of static or allocated memory

• UINT32 prealloc [VOS_MEM_NBLOCKSIZES]
memory block structure

4.22.1

Detailed Description

Enumeration type for memory pre-fragmentation, reuse of VOS definition.
Structure describing memory (and its pre-fragmentation)
The documentation for this struct was generated from the following file:

• trdp_types.h
Generated by Doxygen

41

42

Data Structure Documentation

4.23

TRDP_MEM_STATISTICS_T Struct Reference

Structure containing all general memory statistics information.

#include 

Data Fields
• UINT32 total
total memory size

• UINT32 free
free memory size

• UINT32 minFree
minimal free memory size in statistics interval

• UINT32 numAllocBlocks
allocated memory blocks

• UINT32 numAllocErr
allocation errors

• UINT32 numFreeErr
free errors

• UINT32 blockSize [VOS_MEM_NBLOCKSIZES]
preallocated memory blocks

• UINT32 usedBlockSize [VOS_MEM_NBLOCKSIZES]
used memory blocks

4.23.1

Detailed Description

Structure containing all general memory statistics information.
The documentation for this struct was generated from the following file:
• trdp_types.h

4.24

TRDP_PD_CONFIG_T Struct Reference

Default PD configuration.

#include 
Collaboration diagram for TRDP_PD_CONFIG_T:

TRDP_HANDLE

addr
pNext

pCachedDS
TRDP_DATASET

pCachedDS
pElement

pfCbFunction

PD_ELE

TRDP_DATASET_ELEMENT_T

pfCbUnmarshall
pfCbMarshall

pSndQueue
pRcvQueue
TRDP_MARSHALL_CONFIG_T

sendParam
TRDP_SEND_PARAM_T

TRDP_SOCKET_TCP

TRDP_PD_STATISTICS_T

TRDP_MD_STATISTICS_T

TRDP_PD_CONFIG_T

sendParam

marshall

pNext

pdDefault
pfCbFunction

TRDP_SESSION

iface
TRDP_SOCKETS

memConfig

TRDP_MEM_CONFIG_T

stats

tcpParams

pd
tcpMd
udpMd

TRDP_STATISTICS_T

mem
TRDP_MEM_STATISTICS_T

Generated by Doxygen

4.25 TRDP_PD_INFO_T Struct Reference

Data Fields
• TRDP_PD_CALLBACK_T pfCbFunction
Pointer to PD callback function.

• void ∗ pRefCon
Pointer to user context for call back.

• TRDP_SEND_PARAM_T sendParam
Default send parameters.

• TRDP_FLAGS_T flags
Default flags for PD packets.

• UINT32 timeout
Default timeout in us.

• TRDP_TO_BEHAVIOR_T toBehavior
Default timeout behavior.

• UINT16 port
Port to be used for PD communication.

4.24.1

Detailed Description

Default PD configuration.
The documentation for this struct was generated from the following file:

• trdp_types.h

4.25

TRDP_PD_INFO_T Struct Reference

Process data info from received telegram; allows the application to generate responses.

#include 

Data Fields
• TRDP_IP_ADDR_T srcIpAddr
source IP address for filtering

• TRDP_IP_ADDR_T destIpAddr
destination IP address for filtering

• UINT32 seqCount
sequence counter

• UINT16 protVersion
Protocol version.

• TRDP_MSG_T msgType
Protocol ('PD', 'MD', ...)

• UINT32 comId
ComID.

• UINT32 etbTopoCnt
received ETB topocount

• UINT32 opTrnTopoCnt
Generated by Doxygen

43

44

Data Structure Documentation

received operational train directory topocount

• UINT32 replyComId
ComID for reply (request only)

• TRDP_IP_ADDR_T replyIpAddr
IP address for reply (request only)

• const void ∗ pUserRef
User reference given with the local subscribe.

• TRDP_ERR_T resultCode
error code

• TRDP_URI_HOST_T srcHostURI
source URI host part (unused)

• TRDP_URI_HOST_T destHostURI
destination URI host part (unused)

• TRDP_TO_BEHAVIOR_T toBehavior
callback can decide about handling of data on timeout

4.25.1

Detailed Description

Process data info from received telegram; allows the application to generate responses.
Note: Not all fields are relevant for each message type!
The documentation for this struct was generated from the following file:
• trdp_types.h

4.26

TRDP_PD_STATISTICS_T Struct Reference

Structure containing all general PD statistics information.

#include 

Data Fields
• UINT32 defQos
default QoS for PD

• UINT32 defTtl
default TTL for PD

• UINT32 defTimeout
default timeout in us for PD

• UINT32 numSubs
number of subscribed ComId's

• UINT32 numPub
number of published ComId's

• UINT32 numRcv
number of received PD packets

• UINT32 numCrcErr
number of received PD packets with CRC err

Generated by Doxygen

4.27 TRDP_PROCESS_CONFIG_T Struct Reference

• UINT32 numProtErr
number of received PD packets with protocol err

• UINT32 numTopoErr
number of received PD packets with wrong topo count

• UINT32 numNoSubs
number of received PD push packets without subscription

• UINT32 numNoPub
number of received PD pull packets without publisher

• UINT32 numTimeout
number of PD timeouts

• UINT32 numSend
number of sent PD packets

• UINT32 numMissed
number of packets skipped

4.26.1

Detailed Description

Structure containing all general PD statistics information.
The documentation for this struct was generated from the following file:
• trdp_types.h

4.27

TRDP_PROCESS_CONFIG_T Struct Reference

Various flags/general TRDP options for library initialization.

#include 

Data Fields
• TRDP_LABEL_T hostName
Host name.

• TRDP_LABEL_T leaderName
Leader name dependant on redundancy concept.

• UINT32 cycleTime
TRDP main process cycle time in us.

• UINT32 priority
TRDP main process priority (0-255, 0=default, 255=highest)

• TRDP_OPTION_T options
TRDP options.

4.27.1

Detailed Description

Various flags/general TRDP options for library initialization.
The documentation for this struct was generated from the following file:
• trdp_types.h
Generated by Doxygen

45

46

Data Structure Documentation

4.28

TRDP_PROP_T Struct Reference

Application defined properties.

#include 

Data Fields
• TRDP_SHORT_VERSION_T ver
properties version information, application defined

• UINT16 len
properties length in number of octets, application defined, must be a multiple of 4 octets for alignment reasons value
range: 0..32768

• UINT8 prop [1]
properties, application defined

4.28.1

Detailed Description

Application defined properties.
The documentation for this struct was generated from the following file:

• tau_tti_types.h

4.29

TRDP_PUB_STATISTICS_T Struct Reference

Table containing particular PD publishing information.

#include 

Data Fields
• UINT32 comId
Published ComId.

• TRDP_IP_ADDR_T destAddr
IP address of destination for this publishing.

• UINT32 cycle
Publishing cycle in us.

• UINT32 redId
Redundancy group id.

• UINT32 redState
Redundant state.Leader or Follower.

• UINT32 numPut
Number of packet updates.

• UINT32 numSend
Number of packets sent out.
Generated by Doxygen

4.30 TRDP_RED_STATISTICS_T Struct Reference

4.29.1

Detailed Description

Table containing particular PD publishing information.

4.29.2

Field Documentation

4.29.2.1

destAddr

TRDP_IP_ADDR_T TRDP_PUB_STATISTICS_T::destAddr

IP address of destination for this publishing.
The documentation for this struct was generated from the following file:

• trdp_types.h

4.30

TRDP_RED_STATISTICS_T Struct Reference

A table containing PD redundant group information.

#include 

Data Fields
• UINT32 id
Redundant Id.

• UINT32 state
Redundant state.Leader or Follower.

4.30.1

Detailed Description

A table containing PD redundant group information.
The documentation for this struct was generated from the following file:

• trdp_types.h

4.31

TRDP_SDT_PAR_T Struct Reference

Types to read out the XML configuration.

#include 
Generated by Doxygen

47

48

Data Structure Documentation

Data Fields
• UINT32 smi1
Safe message identifier - unique for this message at consist level.

• UINT32 smi2
Safe message identifier - unique for this message at consist level.

• UINT32 cmThr
Channel monitoring threshold.

• UINT16 udv
User data version.

• UINT16 rxPeriod
Sink cycle time.

• UINT16 txPeriod
Source cycle time.

• UINT16 nGuard
Initial timeout cycles.

• UINT8 nrxSafe
Timout cycles.

• UINT8 reserved1
Reserved for future use.

• UINT16 reserved2
Reserved for future use.

4.31.1

Detailed Description

Types to read out the XML configuration.
The documentation for this struct was generated from the following file:

• tau_xml.h

4.32

TRDP_SEND_PARAM_T Struct Reference

Quality/type of service and time to live.

#include 

Data Fields
• UINT8 qos
Quality of service (default should be 5 for PD and 3 for MD)

• UINT8 ttl
Time to live (default should be 64)

• UINT8 retries
Retries from XML file.
Generated by Doxygen

4.33 TRDP_SEQ_CNT_ENTRY_T Struct Reference

4.32.1

49

Detailed Description

Quality/type of service and time to live.
The documentation for this struct was generated from the following file:
• trdp_types.h

4.33

TRDP_SEQ_CNT_ENTRY_T Struct Reference

Tuples of last received sequence counter per comId.

#include 

Data Fields
• UINT32 lastSeqCnt
Sequence counter value for comId.

• TRDP_IP_ADDR_T srcIpAddr
Source IP address.

• TRDP_MSG_T msgType
message type

4.33.1

Detailed Description

Tuples of last received sequence counter per comId.
The documentation for this struct was generated from the following file:
• trdp_private.h

4.34

TRDP_SESSION Struct Reference

Session/application variables store.

#include 
Collaboration diagram for TRDP_SESSION:

TRDP_MEM_STATISTICS_T

TRDP_PD_STATISTICS_T

mem
pd
tcpMd
udpMd

TRDP_STATISTICS_T
stats

TRDP_MD_STATISTICS_T

TRDP_SEND_PARAM_T

sendParam

sendParam
TRDP_SOCKETS

TRDP_SOCKET_TCP

tcpParams
TRDP_MEM_CONFIG_T

pfCbUnmarshall
pfCbMarshall
TRDP_DATASET

pCachedDS
pElement

iface
memConfig
marshall

pdDefault

TRDP_PD_CONFIG_T

pfCbFunction
TRDP_SESSION
pfCbFunction

TRDP_MARSHALL_CONFIG_T

pSndQueue
pRcvQueue

pNext
PD_ELE

TRDP_DATASET_ELEMENT_T
TRDP_HANDLE
pCachedDS

Generated by Doxygen

pNext

addr

50

Data Structure Documentation

Data Fields
• struct TRDP_SESSION ∗ pNext
Pointer to next session.

• VOS_MUTEX_T mutex
protect this session

• TRDP_IP_ADDR_T realIP
Real IP address.

• TRDP_IP_ADDR_T virtualIP
Virtual IP address.

• UINT32 etbTopoCnt
current valid topocount or zero

• UINT32 opTrnTopoCnt
current valid topocount or zero

• TRDP_TIME_T nextJob
Store for next select interval.

• TRDP_PRINT_DBG_T pPrintDebugString
Pointer to function to print debug information.

• TRDP_MARSHALL_CONFIG_T marshall
Marshalling(unMarshalling configuration.

• TRDP_PD_CONFIG_T pdDefault
Default configuration for process data.

• TRDP_MEM_CONFIG_T memConfig
Internal memory handling configuration.

• TRDP_OPTION_T option
Stack behavior options.

• TRDP_SOCKETS_T iface [VOS_MAX_SOCKET_CNT]
Collection of sockets to use.

• PD_ELE_T ∗ pSndQueue
pointer to first element of send queue

• PD_ELE_T ∗ pRcvQueue
pointer to first element of rcv queue

• PD_PACKET_T ∗ pNewFrame
pointer to received PD frame

• TRDP_TIME_T initTime
initialization time of session

• TRDP_STATISTICS_T stats
statistics of this session

4.34.1

Detailed Description

Session/application variables store.
The documentation for this struct was generated from the following file:

• trdp_private.h
Generated by Doxygen

4.35 TRDP_SOCKET_TCP Struct Reference

4.35

51

TRDP_SOCKET_TCP Struct Reference

TCP parameters.

#include 

Data Fields
• TRDP_IP_ADDR_T cornerIp
The other TCP corner Ip.

• BOOL8 notSend
If the message has been sent uncompleted.

• TRDP_TIME_T connectionTimeout
TCP socket connection Timeout.

• BOOL8 sendNotOk
The sending timeout will be start.

• TRDP_TIME_T sendingTimeout
The timeout sending the message.

• BOOL8 addFileDesc
Ready to add the socket in the fd.

• BOOL8 morituri
about to die

4.35.1

Detailed Description

TCP parameters.
The documentation for this struct was generated from the following file:
• trdp_private.h

4.36

TRDP_SOCKETS Struct Reference

Socket item.

#include 
Collaboration diagram for TRDP_SOCKETS:

TRDP_SEND_PARAM_T

TRDP_SOCKET_TCP

sendParam
TRDP_SOCKETS

Generated by Doxygen

tcpParams

52

Data Structure Documentation

Data Fields
• SOCKET sock
vos socket descriptor to use

• TRDP_IP_ADDR_T bindAddr
Defines the interface to use.

• TRDP_SEND_PARAM_T sendParam
Send parameters.

• TRDP_SOCK_TYPE_T type
Usage of this socket.

• BOOL8 rcvMostly
Used for receiving.

• INT16 usage
No.

• TRDP_SOCKET_TCP_T tcpParams
Params used for TCP.

• TRDP_IP_ADDR_T mcGroups [VOS_MAX_MULTICAST_CNT]
List of multicast addresses for this socket.

4.36.1

Detailed Description

Socket item.

4.36.2

Field Documentation

4.36.2.1

usage

INT16 TRDP_SOCKETS::usage

No.
of current users of this socket
The documentation for this struct was generated from the following file:

• trdp_private.h

4.37

TRDP_STATISTICS_REQUEST_T Struct Reference

TRDP statistics type definitions.

#include 
Generated by Doxygen

4.38 TRDP_STATISTICS_T Struct Reference

53

Data Fields
• UINT32 comId
ComId to request: 35...41.

4.37.1

Detailed Description

TRDP statistics type definitions.

Statistical data regarding the former info provided via SNMP the following information was left out/can be implemented additionally using MD:

• PD subscr table: ComId, sourceIpAddr, destIpAddr, cbFct?, timout, toBehavior, counter
• PD publish table: ComId, destIpAddr, redId, redState cycle, ttl, qos, counter
• PD join table: joined MC address table
• MD listener table: ComId destIpAddr, destUri, cbFct?, counter
• Memory usageStructure containing comId for MD statistics request (ComId 32).

The documentation for this struct was generated from the following file:

• trdp_types.h

4.38

TRDP_STATISTICS_T Struct Reference

Structure containing all general memory, PD and MD statistics information.

#include 
Collaboration diagram for TRDP_STATISTICS_T:

TRDP_PD_STATISTICS_T

TRDP_MD_STATISTICS_T

pd

tcpMd
udpMd

TRDP_STATISTICS_T

Generated by Doxygen

TRDP_MEM_STATISTICS_T

mem

54

Data Structure Documentation

Data Fields
• UINT32 version
TRDP version.

• TIMEDATE64 timeStamp
actual time stamp

• TIMEDATE32 upTime
time in sec since last initialisation

• TIMEDATE32 statisticTime
time in sec since last reset of statistics

• TRDP_NET_LABEL_T hostName
host name

• TRDP_NET_LABEL_T leaderName
leader host name

• TRDP_IP_ADDR_T ownIpAddr
own IP address

• TRDP_IP_ADDR_T leaderIpAddr
leader IP address

• UINT32 processPrio
priority of TRDP process

• UINT32 processCycle
cycle time of TRDP process in microseconds

• UINT32 numJoin
number of joins

• UINT32 numRed
number of redundancy groups

• TRDP_MEM_STATISTICS_T mem
memory statistics

• TRDP_PD_STATISTICS_T pd
pd statistics

• TRDP_MD_STATISTICS_T udpMd
UDP md statistics.

• TRDP_MD_STATISTICS_T tcpMd
TCP md statistics.

4.38.1

Detailed Description

Structure containing all general memory, PD and MD statistics information.
The documentation for this struct was generated from the following file:

• trdp_types.h

4.39

TRDP_SUBS_STATISTICS_T Struct Reference

Table containing particular PD subscription information.

#include 
Generated by Doxygen

4.39 TRDP_SUBS_STATISTICS_T Struct Reference

Data Fields
• UINT32 comId
Subscribed ComId.

• TRDP_IP_ADDR_T joinedAddr
Joined IP address.

• TRDP_IP_ADDR_T filterAddr
Filter IP address, i.e IP address of the sender for this subscription, 0.0.0.0 in case all senders.

• UINT32 callBack
call back function if used

• UINT32 userRef
User reference if used.

• UINT32 timeout
Time-out value in us.

• TRDP_ERR_T status
Receive status information TRDP_NO_ERR, TRDP_TIMEOUT_ERR.

• UINT32 toBehav
Behavior at time-out.

• UINT32 numRecv
Number of packets received for this subscription.

• UINT32 numMissed
number of packets skipped for this subscription

4.39.1

Detailed Description

Table containing particular PD subscription information.

4.39.2

Field Documentation

4.39.2.1

filterAddr

TRDP_IP_ADDR_T TRDP_SUBS_STATISTICS_T::filterAddr

Filter IP address, i.e IP address of the sender for this subscription, 0.0.0.0 in case all senders.

4.39.2.2

timeout

UINT32 TRDP_SUBS_STATISTICS_T::timeout

Time-out value in us.
0 = No time-out supervision
Generated by Doxygen

55

56

Data Structure Documentation

4.39.2.3

toBehav

UINT32 TRDP_SUBS_STATISTICS_T::toBehav

Behavior at time-out.
Set data to zero / keep last value
The documentation for this struct was generated from the following file:

• trdp_types.h

4.40

TRDP_VEHICLE_INFO_T Struct Reference

vehicle information structure

#include 
Collaboration diagram for TRDP_VEHICLE_INFO_T:

TRDP_PROP_T
vehProp
TRDP_VEHICLE_INFO_T

Data Fields
• TRDP_NET_LABEL_T vehId
vehicle identifier label,application defined (e.g.

• TRDP_NET_LABEL_T vehType
vehicle type,application defined

• UINT8 vehOrient
vehicle orientation '01'B = same as consist direction '10'B = inverse to consist direction

• UINT8 cstVehNo
Sequence number of vehicle in consist(1..16)

• ANTIVALENT8 tractVeh
vehicle is a traction vehicle '01'B = vehicle is not a traction vehicle '10'B = vehicle is a traction vehicle

• UINT8 reserved01
for future use (= 0)

• TRDP_PROP_T vehProp
static vehicle properties
Generated by Doxygen

4.41 TRDP_XML_DOC_HANDLE_T Struct Reference

4.40.1

Detailed Description

vehicle information structure

4.40.2

Field Documentation

4.40.2.1

vehId

TRDP_NET_LABEL_T TRDP_VEHICLE_INFO_T::vehId

vehicle identifier label,application defined (e.g.
UIC vehicle identification number) vehId of vehicle with vehNo==1 is used also as cstId
The documentation for this struct was generated from the following file:

• tau_tti_types.h

4.41

TRDP_XML_DOC_HANDLE_T Struct Reference

Parsed XML document handle.

#include 

Data Fields
• struct XML_HANDLE ∗ pXmlDocument
XML document context.

4.41.1

Detailed Description

Parsed XML document handle.
The documentation for this struct was generated from the following file:

• tau_xml.h

4.42

VOS_SOCK_OPT_T Struct Reference

Common socket options.

#include 
Generated by Doxygen

57

58

Data Structure Documentation

Data Fields
• UINT8 qos
quality/type of service 0...7

• UINT8 ttl
time to live for unicast (default 64)

• UINT8 ttl_multicast
time to live for multicast

• BOOL8 reuseAddrPort
allow reuse of address and port

• BOOL8 nonBlocking
use non blocking calls

• BOOL8 no_mc_loop
no multicast loop back

• BOOL8 no_udp_crc
supress udp crc computation

4.42.1

Detailed Description

Common socket options.
The documentation for this struct was generated from the following file:
• vos_sock.h

4.43

VOS_VERSION_T Struct Reference

Version information.

#include 

Data Fields
• UINT8 ver
Version - incremented for incompatible changes.

• UINT8 rel
Release - incremented for compatible changes.

• UINT8 upd
Update - incremented for bug fixes.

• UINT8 evo
Evolution - incremented for build.

4.43.1

Detailed Description

Version information.
The documentation for this struct was generated from the following file:
• vos_types.h

Generated by Doxygen

Chapter 5

File Documentation

5.1

iec61375-2-3.h File Reference

All definitions from IEC 61375-2-3.
This graph shows which files directly or indirectly include this file:

iec61375-2-3.h

trdp_types.h

tau_tti_types.h

tau_tti.h

tau_ctrl_types.h

tau_ctrl.h

tau_marshall.h

tau_dnr_types.h

trdp_if_light.h

tau_dnr.h

tau_cstinfo.c

trdp_private.h

trdp_mdcom.h

tau_dnr.c

tau_marshall.c

trdp_mdcom.c

trdp_utils.h

trdp_if.h

trdp_utils.c

trdp_pdcom.c

tau_xml.h

trdp_stats.h

trdp_pdcom.h

trdp_xml.h

trdp_if.c

trdp_stats.c

trdp_xml.c

tau_xml.c

tau_tti.c

tau_ctrl.c

Macros
• #define ETB_WAIT_TIMER_VALUE 5u /∗ Compute train dir. IEC61375-2-3 Ch. 5.3.2.3 ∗/
Time out values (in seconds)

• #define TRDP_PD_UDP_PORT 17224u
TRDP defines (from former trpd_proto.h)

• #define TRDP_MD_UDP_PORT 17225u
IANA assigned message data UDP port.

• #define TRDP_MD_TCP_PORT 17225u
IANA assigned message data TCP port.

• #define TRDP_PROTO_VER 0x0100u
Protocol version.

• #define TRDP_PROTOCOL_VERSION_CHECK_MASK 0xFF00u
Version check, two digits are relevant.

• #define TRDP_SESS_ID_SIZE 16u
Session ID (UUID) size in MD header.

• #define TRDP_USR_URI_SIZE 32u
max.

• #define TRDP_MD_INFINITE_TIME (0)

60

File Documentation

Definitions for time out behaviour accd.

• #define TRDP_MD_DEFAULT_REPLY_TIMEOUT 5000000u
Default MD communication parameters.

• #define TRDP_MD_DEFAULT_CONFIRM_TIMEOUT 1000000u
[us] default confirm time out 1s

• #define TRDP_MD_DEFAULT_CONNECTION_TIMEOUT 60000000u
[us] Socket connection time out 1min

• #define TRDP_MD_DEFAULT_SENDING_TIMEOUT 5000000u
[us] Socket sending time out 5s

• #define TRDP_PD_DEFAULT_QOS 5u
Default PD communication parameters.

• #define TRDP_PD_DEFAULT_TIMEOUT 100000u
[us] 100ms default PD timeout

• #define TRDP_PROCESS_DEFAULT_CYCLE_TIME 10000u
Default TRDP process options.

• #define TRDP_PROCESS_DEFAULT_PRIORITY 64u
Default priority of TRDP process.

• #define TRDP_PROCESS_DEFAULT_OPTIONS TRDP_OPTION_TRAFFIC_SHAPING
Default options for TRDP process.

• #define TRDP_MIN_PD_HEADER_SIZE sizeof(PD_HEADER_T)
PD packet properties.

• #define TRDP_MAX_PD_DATA_SIZE 1432u
PD data.

• #define TRDP_MAX_MD_DATA_SIZE 65388u
MD packet properties.

• #define TRDP_MAX_MD_RETRIES 2u
Maximum values.

• #define TRDP_MAX_LABEL_LEN 16u
label length incl.

• #define TRDP_MAX_URI_USER_LEN (2u ∗ TRDP_MAX_LABEL_LEN)
URI user part excl.

• #define TRDP_MAX_URI_HOST_LEN (4u ∗ TRDP_MAX_LABEL_LEN)
URI host part length excl.

• #define TRDP_MAX_URI_LEN ((6u ∗ TRDP_MAX_LABEL_LEN) + 8u)
URI length excl.

• #define TRDP_MAX_FILE_NAME_LEN 128u
path and file name length incl.

• #define TRDP_VAR_SIZE 0u
Variable size dataset.

• #define TRDP_MSG_PD 0x5064u
Message Types.

• #define TRDP_MSG_PP 0x5070u
'Pp' PD Data (Pull Reply)

• #define TRDP_MSG_PR 0x5072u
'Pr' PD Request

• #define TRDP_MSG_PE 0x5065u
'Pe' PD Error

• #define TRDP_MSG_MN 0x4D6Eu
'Mn' MD Notification (Request w/o reply)

• #define TRDP_MSG_MR 0x4D72u
'Mr' MD Request with reply
Generated by Doxygen

5.1 iec61375-2-3.h File Reference

• #define TRDP_MSG_MP 0x4D70u
'Mp' MD Reply without confirmation

• #define TRDP_MSG_MQ 0x4D71u
'Mq' MD Reply with confirmation

• #define TRDP_MSG_MC 0x4D63u
'Mc' MD Confirm

• #define TRDP_MSG_ME 0x4D65u
'Me' MD Error

• #define ETB0_ALL_END_DEVICES_IP "239.193.0.0"
from Table 22

• #define ETB_CTRL_COMID 1u
Reserved COMIDs in the range 1 ...

• #define ETB_CTRL_CYC 500u
[ms] 0.5s

• #define ETB_CTRL_TO 3000u
[ms]3s

• #define TRDP_ETBCTRL_COMID ETB_CTRL_COMID
alternative name

• #define CSTINFO_COMID 2u
Consist Info telegram (Message data notification 'Mn')

• #define TRDP_CSTINFO_COMID CSTINFO_COMID
alternative name

• #define CSTINFOCTRL_COMID 3u
Consist Info control/request telegram (Message data notification 'Mn')

• #define TRDP_CSTINFOCTRL_COMID CSTINFOCTRL_COMID
alternative name

• #define TRDP_COMID_ECHO 10u
Reserved in Annex D & E.

• #define TTDB_STATUS_COMID 100u
TTDB manager telegram PD.

• #define TTDB_STATUS_CYC 1000u
[ms] Push

• #define TTDB_STATUS_TO 5000u
[ms] 5s

• #define TTDB_OP_DIR_INFO_COMID 101u
TTDB manager telegram MD: Push the OP_TRAIN_DIRECTORY.

• #define TTDB_OP_DIR_INFO_DS "TTDB_OP_TRAIN_DIRECTORY_INFO"
OP_TRAIN_DIRECTORY.

• #define TTDB_TRN_DIR_REQ_COMID 102u
TTDB manager telegram MD: Get the TRAIN_DIRECTORY.

• #define TTDB_TRN_DIR_REQ_TO 3000u
3s timeout

• #define TTDB_TRN_DIR_REP_COMID 103u
MD reply.

• #define TTDB_TRN_DIR_REP_DS "TTDB_TRAIN_DIRECTORY_INFO_REPLY"
TRAIN_DIRECTORY.

• #define TTDB_STAT_CST_REQ_COMID 104u
TTDB manager telegram MD: Get the static consist information.

• #define TTDB_STAT_CST_REQ_TO 3000u
[ms] 3s timeout

• #define TTDB_STAT_CST_REP_DS "TTDB_STATIC_CONSIST_INFO_REPLY"
Generated by Doxygen

61

62

File Documentation

CONSIST_INFO.

• #define TTDB_NET_DIR_REQ_COMID 106u
TTDB manager telegram MD: Get the NETWORK_TRAIN_DIRECTORY.

• #define TTDB_NET_DIR_REQ_TO 3000u
[ms] 3s timeout

• #define TTDB_NET_DIR_REP_COMID 107u
MD reply.

• #define TTDB_NET_DIR_REP_DS "TTDB_TRAIN_NETWORK_DIRECTORY_INFO_REPLY"
TRAIN_NETWORK_DIRECTORY.

• #define TTDB_OP_DIR_INFO_REQ_COMID 108u
TTDB manager telegram MD: Get the OP_TRAIN_DIRECTORY.

• #define TTDB_OP_DIR_INFO_REQ_TO 3000u
[ms] 3s timeout

• #define TTDB_OP_DIR_INFO_REP_DS "TTDB_OP_TRAIN_DIR_INFO"
OP_TRAIN_DIRECTORY.

• #define TTDB_READ_CMPLT_REQ_COMID 110u
TTDB manager telegram MD: Get the TTDB.

• #define TTDB_READ_CMPLT_REQ_DS "TTDB_READ_COMPLETE_REQUEST"
ETBx.

• #define TTDB_READ_CMPLT_REQ_TO 3000u
[ms] 3s timeout

• #define TTDB_READ_CMPLT_REP_COMID 111u
MD reply.

• #define TTDB_READ_CMPLT_REP_DS "TTDB_READ_COMPLETE_REPLY"
TRDP_READ_COMPLETE_REPLY_T.

• #define ECSP_CTRL_COMID 120u
ECSP Control telegram.

• #define ECSP_CTRL_CYC 1000u
[ms] 1s

• #define ECSP_CTRL_TO 5000u
[ms] 5s

• #define ECSP_CTRL_DEST_URI "devECSP.anyVeh.lCst.lClTrn.lTrn"
10.0.0.1

• #define TRDP_ECSP_CTRL_COMID ECSP_CTRL_COMID
Etb control message.

• #define ECSP_STATUS_COMID 121u
ECSP status telegram.

• #define ECSP_STATUS_CYC 1000u
[ms] 1s

• #define ECSP_STATUS_TO 5000u
[ms] 5s

• #define ECSP_STATUS_DEST_URI "devECSC.anyVeh.lCst.lClTrn.lTrn"
10.0.0.100

• #define ECSP_CONF_REQ_COMID 122u
ECSP Confirmation Request telegram MD:

• #define ECSP_CONF_REQ_TO 3000u
[ms]

• #define ECSP_CONF_REQ_URI "devECSP.anyVeh.lCst.lClTrn.lTrn"
10.0.0.1

• #define ECSP_CONF_REP_TO 3000u
[ms]
Generated by Doxygen

5.1 iec61375-2-3.h File Reference

63

• #define ETBN_CTRL_REQ_COMID 130u
ETBN Control & Status Telegram MD.

• #define ETBN_CTRL_REQ_DS "ETBN_CTRL"
ETBx.

• #define ETBN_CTRL_REQ_TO 3000u
[ms] 3s timeout

• #define ETBN_CTRL_REP_DS "ETBN_STATUS"
ETBN status reply.

• #define ETBN_TRN_NET_DIR_REQ_COMID 132u
ETBN Control Telegram MD.

• #define ETBN_TRN_NET_DIR_REQ_TO 3000u
[ms] 3s timeout

• #define TCN_DNS_REQ_COMID 140u
TCN-DNS Request Telegram MD.

• #define TCN_DNS_REQ_TO 3000u
[ms] 3s timeout

• #define TCN_DNS_REQ_TO_US 3000000u
[us] 3s timeout

• #define TRDP_ETBCTRL_DSID 1u
TRDP reserved data set ids in the range 1 ...

5.1.1

Detailed Description

All definitions from IEC 61375-2-3.
Note
Project: TCNOpen TRDP

Author
Bernd Loehr, NewTec GmbH, 2015-09-11

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was
not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
Id
iec61375-2-3.h 1755 2018-08-07 12:10:03Z bloehr
BL
AHW
AHW
BL
BL
BL

2018-01-29:
2017-11-05:
2017-05-22:
2017-04-28:
2017-02-08:
2016-05-04:

Ticket
Ticket
Ticket
Ticket
Ticket
Ticket

#188 Typo in the TRDP_VAR_SIZE definition
#179 Max. number of retries of a MD request needs to be checked
#159 Infinit timeout at TRDB level is 0 acc. standard
#155: Kill trdp_proto.h - move definitions to iec61375-2-3.h
#142: Compiler warnings / MISRA-C 2012 issues
#118: Fix defines to match IEC IS 2015

from trdp_proto.h
BL
BL
BL
BL
BL
BL

2017-03-13:
2017-03-01:
2017-02-08:
2016-11-09:
2016-06-08:
2014-07-14:

Generated by Doxygen

Ticket #154 ComIds and DSIds literals (#define TRDP_...) in trdp_proto.h too long
Ticket #149 SourceUri and DestinationUri don’t with 32 characters
Ticket #142: Compiler warnings / MISRA-C 2012 issues
Default PD/MD parameter defines moved from trdp_private.h
Ticket #120: ComIds for statistics changed to proposed 61375 errata
Ticket #46: Protocol change: operational topocount needed

64

File Documentation

5.1.2

Macro Definition Documentation

5.1.2.1

ETB_CTRL_COMID

#define ETB_CTRL_COMID 1u

Reserved COMIDs in the range 1 ...
1000 ETB Control telegram

5.1.2.2

TRDP_ETBCTRL_DSID

#define TRDP_ETBCTRL_DSID 1u

TRDP reserved data set ids in the range 1 ...
1000

5.1.2.3

TRDP_MAX_FILE_NAME_LEN

#define TRDP_MAX_FILE_NAME_LEN 128u

path and file name length incl.
terminating '0'

5.1.2.4

TRDP_MAX_LABEL_LEN

#define TRDP_MAX_LABEL_LEN 16u

label length incl.
terminating '0'

5.1.2.5

TRDP_MAX_MD_DATA_SIZE

#define TRDP_MAX_MD_DATA_SIZE 65388u

MD packet properties.
MD payload size
Generated by Doxygen

5.1 iec61375-2-3.h File Reference

5.1.2.6

TRDP_MAX_URI_HOST_LEN

#define TRDP_MAX_URI_HOST_LEN (4u ∗ TRDP_MAX_LABEL_LEN)

URI host part length excl.
terminating '0'

5.1.2.7

TRDP_MAX_URI_LEN

#define TRDP_MAX_URI_LEN ((6u ∗ TRDP_MAX_LABEL_LEN) + 8u)

URI length excl.
terminating '0' and 1 padding byte

5.1.2.8

TRDP_MAX_URI_USER_LEN

#define TRDP_MAX_URI_USER_LEN (2u ∗ TRDP_MAX_LABEL_LEN)

URI user part excl.
terminating '0'

5.1.2.9

TRDP_MD_DEFAULT_REPLY_TIMEOUT

#define TRDP_MD_DEFAULT_REPLY_TIMEOUT 5000000u

Default MD communication parameters.
[us] default reply timeout 5s

5.1.2.10

TRDP_MD_INFINITE_TIME

#define TRDP_MD_INFINITE_TIME (0)

Definitions for time out behaviour accd.
table A.18

5.1.2.11

TRDP_MIN_PD_HEADER_SIZE

#define TRDP_MIN_PD_HEADER_SIZE sizeof(PD_HEADER_T)

PD packet properties.
PD header size with FCS
Generated by Doxygen

65

66

5.1.2.12

File Documentation

TRDP_MSG_PD

#define TRDP_MSG_PD 0x5064u

Message Types.
'Pd' PD Data

5.1.2.13

TRDP_PD_UDP_PORT

#define TRDP_PD_UDP_PORT 17224u

TRDP defines (from former trpd_proto.h)
IANA assigned process data UDP port

5.1.2.14

TRDP_PROCESS_DEFAULT_CYCLE_TIME

#define TRDP_PROCESS_DEFAULT_CYCLE_TIME 10000u

Default TRDP process options.
[us] 10ms cycle time for TRDP process

5.1.2.15

TRDP_USR_URI_SIZE

#define TRDP_USR_URI_SIZE 32u

max.
User URI size in MD header

5.1.2.16

TTDB_NET_DIR_REQ_COMID

#define TTDB_NET_DIR_REQ_COMID 106u

TTDB manager telegram MD: Get the NETWORK_TRAIN_DIRECTORY.
MD request

5.1.2.17

TTDB_OP_DIR_INFO_COMID

#define TTDB_OP_DIR_INFO_COMID 101u

TTDB manager telegram MD: Push the OP_TRAIN_DIRECTORY.
MD notification
Generated by Doxygen

5.2 tau_cstinfo.c File Reference

5.1.2.18

67

TTDB_STAT_CST_REQ_COMID

#define TTDB_STAT_CST_REQ_COMID 104u

TTDB manager telegram MD: Get the static consist information.
MD request

5.1.2.19

TTDB_TRN_DIR_REQ_COMID

#define TTDB_TRN_DIR_REQ_COMID 102u

TTDB manager telegram MD: Get the TRAIN_DIRECTORY.
MD request

5.2

tau_cstinfo.c File Reference

Functions for consist information access.

#include
#include
#include
#include
#include



"trdp_if_light.h"
"tau_tti.h"
"vos_sock.h"

Include dependency graph for tau_cstinfo.c:

tau_cstinfo.c

string.h

stdio.h

tau_tti.h

tau_tti_types.h

trdp_if_light.h

trdp_types.h

vos_sock.h

vos_private.h

vos_mem.h

iec61375-2-3.h

vos_thread.h

vos_types.h

stdint.h

Generated by Doxygen

68

File Documentation

This graph shows which files directly or indirectly include this file:

tau_cstinfo.c

tau_tti.c

Functions
• UINT16 cstInfoGetPropSize (TRDP_CONSIST_INFO_T ∗pCstInfo)
Getter function to retrieve a value from the consist info telegram value.

5.2.1

Detailed Description

Functions for consist information access.
Note
Project: TCNOpen TRDP prototype stack
Author
B. Loehr (initial version)
Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2015. All rights reserved.
Id
tau_cstinfo.c 1646 2017-07-05 14:34:41Z bloehr
BL 2017-05-08: Compiler warnings, doxygen comment errors
BL 2017-04-28: Ticket #155: Kill trdp_proto.h - move definitions to iec61375-2-3.h
BL 2016-02-24: C89 compatibility (thanks to Robert)

5.2.2

Function Documentation

5.2.2.1

cstInfoGetPropSize()

UINT16 cstInfoGetPropSize (
TRDP_CONSIST_INFO_T ∗ pCstInfo )

Getter function to retrieve a value from the consist info telegram value.

Generated by Doxygen

5.3 tau_ctrl.c File Reference
Parameters
in pCstInfo

69

pointer to packed consist info in network byte order

Return values
len

Here is the call graph for this function:

cstInfoGetPropSize

5.3

tau_ctrl.c File Reference

Functions for train switch control.

#include
#include
#include
#include
#include
#include



"trdp_types.h"
"trdp_utils.h"
"trdp_if_light.h"
"tau_ctrl.h"

Generated by Doxygen

vos_ntohs

70

File Documentation

Include dependency graph for tau_ctrl.c:

tau_ctrl.c

string.h

tau_ctrl.h

trdp_if_light.h

trdp_utils.h

vos_utils.h

stdio.h

tau_ctrl_types.h

tau_tti.h

trdp_private.h

tau_tti_types.h

stddef.h

trdp_types.h

vos_sock.h

vos_private.h

vos_mem.h

iec61375-2-3.h

vos_thread.h

vos_types.h

stdint.h

Functions
• EXT_DECL TRDP_ERR_T tau_initEcspCtrl (TRDP_APP_SESSION_T appHandle, TRDP_IP_ADDR_←T ecspIpAddr)
Function to init ECSP control interface.

• EXT_DECL TRDP_ERR_T tau_terminateEcspCtrl (TRDP_APP_SESSION_T appHandle)
Function to close ECSP control interface.

• EXT_DECL TRDP_ERR_T tau_setEcspCtrl (TRDP_APP_SESSION_T appHandle, TRDP_ECSP_CTRL_T
∗pEcspCtrl)
Function to set ECSP control information.

• EXT_DECL TRDP_ERR_T tau_getEcspStat (TRDP_APP_SESSION_T appHandle, TRDP_ECSP_STAT_T
∗pEcspStat, TRDP_PD_INFO_T ∗pPdInfo)
Function to get ECSP status information.

• EXT_DECL TRDP_ERR_T tau_requestEcspConfirm (TRDP_APP_SESSION_T appHandle, const void
∗pUserRef, TRDP_MD_CALLBACK_T pfCbFunction, TRDP_ECSP_CONF_REQUEST_T ∗pEcspConf←Request)
Function for ECSP confirmation/correction request, reply will be received via call back.

5.3.1

Detailed Description

Functions for train switch control.
Note
Project: TCNOpen TRDP prototype stack

Generated by Doxygen

5.3 tau_ctrl.c File Reference

71

Author
Armin-H. Weiss (initial version)

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.

Id
tau_ctrl.c 1711 2018-03-06 16:11:32Z bloehr

BL 2018-03-06: Ticket #101 Optional callback function on PD send
AHW 2017-11-08: Ticket #179 Max. number of retries (part of sendParam) of a MD request needs to be checked
BL 2017-04-28: Ticket #155: Kill trdp_proto.h - move definitions to iec61375-2-3.h

5.3.2

Function Documentation

5.3.2.1

tau_getEcspStat()

EXT_DECL TRDP_ERR_T tau_getEcspStat (
TRDP_APP_SESSION_T appHandle,
TRDP_ECSP_STAT_T ∗ pEcspStat,
TRDP_PD_INFO_T ∗ pPdInfo )

Function to get ECSP status information.
Parameters

in
in,out
in,out

appHandle

Application handle

pEcspStat

Pointer to the ECSP status structure

pPdInfo

Pointer to PD status information

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

module not initialised

TRDP_PARAM_ERR

Parameter error

5.3.2.2

tau_initEcspCtrl()

EXT_DECL TRDP_ERR_T tau_initEcspCtrl (
TRDP_APP_SESSION_T appHandle,
TRDP_IP_ADDR_T ecspIpAddr )
Generated by Doxygen

72

File Documentation

Function to init ECSP control interface.

Generated by Doxygen

5.3 tau_ctrl.c File Reference
Parameters
in appHandle

in

ecspIpAddr

Return values
TRDP_NO_ERR
TRDP_INIT_ERR

5.3.2.3

73

Application handle
ECSP address

no error
initialisation error

tau_requestEcspConfirm()

EXT_DECL TRDP_ERR_T tau_requestEcspConfirm (
TRDP_APP_SESSION_T appHandle,
const void ∗ pUserRef,
TRDP_MD_CALLBACK_T pfCbFunction,
TRDP_ECSP_CONF_REQUEST_T ∗ pEcspConfRequest )

Function for ECSP confirmation/correction request, reply will be received via call back.
Parameters
in appHandle

in
in
in

Application Handle

pUserRef

user reference returned with reply

pfCbFunction

Pointer to callback function, NULL for default

pEcspConfRequest

Pointer to confirmation data

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

module not initialised

TRDP_PARAM_ERR

Parameter error

5.3.2.4

tau_setEcspCtrl()

EXT_DECL TRDP_ERR_T tau_setEcspCtrl (
TRDP_APP_SESSION_T appHandle,
TRDP_ECSP_CTRL_T ∗ pEcspCtrl )

Function to set ECSP control information.
Parameters
in appHandle

in

pEcspCtrl

Generated by Doxygen

Application handle
Pointer to the ECSP control structure

74

File Documentation

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

module not initialised

TRDP_PARAM_ERR

Parameter error

5.3.2.5

tau_terminateEcspCtrl()

EXT_DECL TRDP_ERR_T tau_terminateEcspCtrl (
TRDP_APP_SESSION_T appHandle )

Function to close ECSP control interface.
Parameters
in appHandle

Application handle

Return values
TRDP_NO_ERR
TRDP_NOINIT_ERR
TRDP_UNKNOWN_ERR

5.4

no error
module not initialised
undefined error

tau_ctrl.h File Reference

TRDP utility interface definitions.

#include "trdp_types.h"
#include "tau_tti.h"
#include "tau_ctrl_types.h"
Generated by Doxygen

5.4 tau_ctrl.h File Reference

75

Include dependency graph for tau_ctrl.h:

tau_ctrl.h

tau_ctrl_types.h

tau_tti.h

tau_tti_types.h

trdp_types.h

vos_mem.h

vos_thread.h

vos_types.h

stdint.h

Generated by Doxygen

vos_sock.h

iec61375-2-3.h

vos_private.h

76

File Documentation

This graph shows which files directly or indirectly include this file:

tau_ctrl.h

tau_ctrl.c

Functions
• EXT_DECL TRDP_ERR_T tau_initEcspCtrl (TRDP_APP_SESSION_T appHandle, TRDP_IP_ADDR_←T ecspIpAddr)
Function to init ECSP control interface.

• EXT_DECL TRDP_ERR_T tau_terminateEcspCtrl (TRDP_APP_SESSION_T appHandle)
Function to close ECSP control interface.

• EXT_DECL TRDP_ERR_T tau_setEcspCtrl (TRDP_APP_SESSION_T appHandle, TRDP_ECSP_CTRL_T
∗pEcspCtrl)
Function to set ECSP control information.

• EXT_DECL TRDP_ERR_T tau_getEcspStat (TRDP_APP_SESSION_T appHandle, TRDP_ECSP_STAT_T
∗pEcspStat, TRDP_PD_INFO_T ∗pPdInfo)
Function to get ECSP status information.

• EXT_DECL TRDP_ERR_T tau_requestEcspConfirm (TRDP_APP_SESSION_T appHandle, const void
∗pUserRef, TRDP_MD_CALLBACK_T pfCbFunction, TRDP_ECSP_CONF_REQUEST_T ∗pEcspConf←Request)
Function for ECSP confirmation/correction request, reply will be received via call back.

5.4.1

Detailed Description

TRDP utility interface definitions.
This module provides the interface to the following utilities
• ETB control
Note
Project: TCNOpen TRDP prototype stack
Author
Armin-H. Weiss (initial version)
Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.
Id
tau_ctrl.h 1483 2015-12-16 14:43:30Z bloehr
Generated by Doxygen

5.4 tau_ctrl.h File Reference

5.4.2

Function Documentation

5.4.2.1

tau_getEcspStat()

EXT_DECL TRDP_ERR_T tau_getEcspStat (
TRDP_APP_SESSION_T appHandle,
TRDP_ECSP_STAT_T ∗ pEcspStat,
TRDP_PD_INFO_T ∗ pPdInfo )

Function to get ECSP status information.
Parameters

in
in,out
in,out

appHandle

Application Handle

pEcspStat

Pointer to the ECSP status structure

pPdInfo

Pointer to PD status information

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

module not initialised

TRDP_PARAM_ERR

Parameter error

Parameters

in
in,out
in,out

appHandle

Application handle

pEcspStat

Pointer to the ECSP status structure

pPdInfo

Pointer to PD status information

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

module not initialised

TRDP_PARAM_ERR

Parameter error

5.4.2.2

tau_initEcspCtrl()

EXT_DECL TRDP_ERR_T tau_initEcspCtrl (
TRDP_APP_SESSION_T appHandle,
TRDP_IP_ADDR_T ecspIpAddr )

Function to init ECSP control interface.
Parameters
in appHandle

in

ecspIpAddr

Generated by Doxygen

Application handle
ECSP address

77

78

File Documentation

Return values
TRDP_NO_ERR
TRDP_INIT_ERR

5.4.2.3

no error
initialisation error

tau_requestEcspConfirm()

EXT_DECL TRDP_ERR_T tau_requestEcspConfirm (
TRDP_APP_SESSION_T appHandle,
const void ∗ pUserRef,
TRDP_MD_CALLBACK_T pfCbFunction,
TRDP_ECSP_CONF_REQUEST_T ∗ pEcspConfRequest )

Function for ECSP confirmation/correction request, reply will be received via call back.
Parameters
in appHandle

in
in
in

Application Handle

pUserRef

user reference returned with reply

pfCbFunction

Pointer to callback function, NULL for default

pEcspConfRequest

Pointer to confirmation data

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

module not initialised

TRDP_PARAM_ERR

Parameter error

5.4.2.4

tau_setEcspCtrl()

EXT_DECL TRDP_ERR_T tau_setEcspCtrl (
TRDP_APP_SESSION_T appHandle,
TRDP_ECSP_CTRL_T ∗ pEcspCtrl )

Function to set ECSP control information.
Parameters
in appHandle

in

pEcspCtrl

Application handle
Pointer to the ECSP control structure

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

module not initialised

TRDP_PARAM_ERR

Parameter error

Generated by Doxygen

5.5 tau_ctrl_types.h File Reference

5.4.2.5

tau_terminateEcspCtrl()

EXT_DECL TRDP_ERR_T tau_terminateEcspCtrl (
TRDP_APP_SESSION_T appHandle )

Function to close ECSP control interface.
Parameters
in appHandle

Application handle

Return values
TRDP_NO_ERR
TRDP_UNKNOWN_ERR

Parameters
in appHandle

undefined error

Application handle

Return values
TRDP_NO_ERR
TRDP_NOINIT_ERR
TRDP_UNKNOWN_ERR

5.5

no error

no error
module not initialised
undefined error

tau_ctrl_types.h File Reference

TRDP utility interface definitions.

#include "trdp_types.h"
#include "tau_tti.h"
Generated by Doxygen

79

80

File Documentation

Include dependency graph for tau_ctrl_types.h:

tau_ctrl_types.h

tau_tti.h

tau_tti_types.h

trdp_types.h

vos_mem.h

vos_thread.h

vos_sock.h

iec61375-2-3.h

vos_private.h

vos_types.h

stdint.h

Generated by Doxygen

5.5 tau_ctrl_types.h File Reference

81

This graph shows which files directly or indirectly include this file:

tau_ctrl_types.h

tau_ctrl.h

tau_ctrl.c

Data Structures
• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

5.5.1

Detailed Description

TRDP utility interface definitions.
This module provides the interface to the following

• ETB control type definitions acc. to IEC61375-2-3

Generated by Doxygen

82

File Documentation

Note
Project: TCNOpen TRDP prototype stack

Author
Armin-H. Weiss (initial version)

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.

Id
tau_ctrl_types.h 1763 2018-09-21 16:03:13Z ahweiss

BL 2017-11-13: Ticket #176 TRDP_LABEL_T breaks field alignment -> TRDP_NET_LABEL_T
BL 2017-03-09: Ticket #131 errata: Last change undone (leadVehOfCst defined in corrigendum)
BL 2017-02-09: Ticket #131 TRDP_ECSP_CTRL_T in the tau_ctrl_types.h should not include the leadVehOfCst field

5.6

tau_dnr.c File Reference

Functions for domain name resolution.

#include
#include
#include
#include
#include
#include
#include
#include
#include
#include




"tau_tti.h"
"tau_dnr.h"
"tau_dnr_types.h"
"trdp_utils.h"
"trdp_if_light.h"
"vos_mem.h"
"vos_sock.h"

Include dependency graph for tau_dnr.c:

tau_dnr.c

string.h

trdp_utils.h

trdp_if_light.h

vos_utils.h

stdio.h

trdp_private.h

tau_dnr.h

stddef.h

tau_dnr_types.h

tau_tti.h

ctype.h

tau_tti_types.h

trdp_types.h

vos_sock.h

iec61375-2-3.h

vos_private.h

vos_mem.h

vos_thread.h

vos_types.h

stdint.h

Generated by Doxygen

5.6 tau_dnr.c File Reference

83

Data Structures
• struct DNS_HEADER
DNS header structure.

Macros
• #define TAU_MAX_NO_IF 4u
Default interface should be in the first 4.

• #define TAU_DNS_TIME_OUT_LONG 10u
Timeout in seconds for DNS server reply, if no hosts file provided.

• #define TAU_DNS_TIME_OUT_SHORT 1u
Timeout in seconds for DNS server reply, if hosts file was provided.

• #define TAU_MAX_HOST_URI_LEN 80u
Including EOS!

Typedefs
• typedef struct DNS_HEADER TAU_DNS_HEADER_T
DNS header structure.

Functions
• EXT_DECL TRDP_ERR_T tau_initDnr (TRDP_APP_SESSION_T appHandle, TRDP_IP_ADDR_T dnsIp←Addr, UINT16 dnsPort, const CHAR8 ∗pHostsFileName, TRDP_DNR_OPTS_T dnsOptions)
Function to init the DNR subsystem Initialize the DNR resolver.

• EXT_DECL void tau_deInitDnr (TRDP_APP_SESSION_T appHandle)
Function to deinit DNR.

• EXT_DECL TRDP_DNR_STATE_T tau_DNRstatus (TRDP_APP_SESSION_T appHandle)
Function to get the status of DNR.

• EXT_DECL TRDP_IP_ADDR_T tau_getOwnAddr (TRDP_APP_SESSION_T appHandle)
Function to get the own IP address.

• EXT_DECL TRDP_ERR_T tau_uri2Addr (TRDP_APP_SESSION_T appHandle, TRDP_IP_ADDR_T ∗p←Addr, const TRDP_URI_T pUri)
Function to convert a URI to an IP address.

• EXT_DECL TRDP_ERR_T tau_addr2Uri (TRDP_APP_SESSION_T appHandle, TRDP_URI_HOST_T pUri,
TRDP_IP_ADDR_T addr)
Function to convert an IP address to a URI.

5.6.1

Detailed Description

Functions for domain name resolution.

Note
Project: TCNOpen TRDP prototype stack

Generated by Doxygen

84

File Documentation

Author
B. Loehr (initial version)

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.

Id
tau_dnr.c 1763 2018-09-21 16:03:13Z ahweiss

BL
BL
BL
BL
AHW
BL
BL
BL
BL
BL

2018-08-07:
2018-08-06:
2018-06-20:
2018-05-03:
2017-11-08:
2017-07-25:
2017-05-08:
2017-03-01:
2017-02-08:
2015-12-14:

Ticket #183 tau_getOwnIds declared but not defined
Ticket #210 IF condition for DNS Options incorrect in tau_uri2Addr()
Ticket #184: Building with VS 2015: WIN64 and Windows threads (SOCKET instead of INT32)
Ticket #193 Unused parameter warnings
Ticket #179 Max. number of retries (part of sendParam) of a MD request needs to be checked
Ticket #125: tau_dnr: TCN DNS support missing
Compiler warnings
Ticket #149 SourceUri and DestinationUri don’t with 32 characters
Ticket #124 tau_dnr: Cache keeps etbTopoCount only
Ticket #8: DNR client

5.6.2

Function Documentation

5.6.2.1

tau_addr2Uri()

EXT_DECL TRDP_ERR_T tau_addr2Uri (
TRDP_APP_SESSION_T appHandle,
TRDP_URI_HOST_T pUri,
TRDP_IP_ADDR_T addr )

Function to convert an IP address to a URI.
Receives an IP-Address and translates it into the host part of the corresponding URI. Both unicast and multicast
addresses are accepted.
Parameters
in
appHandle

out
in

Handle returned by tlc_openSession()

pUri

Pointer to a string to return the URI host part

addr

IP address, 0==own address

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

no error
Parameter error

Generated by Doxygen

5.6 tau_dnr.c File Reference

5.6.2.2

85

tau_deInitDnr()

EXT_DECL void tau_deInitDnr (
TRDP_APP_SESSION_T appHandle )

Function to deinit DNR.
Release any resources allocated by DNR.
Parameters
in appHandle

Handle returned by tlc_openSession()

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

5.6.2.3

no error
Parameter error

tau_DNRstatus()

EXT_DECL TRDP_DNR_STATE_T tau_DNRstatus (
TRDP_APP_SESSION_T appHandle )

Function to get the status of DNR.
Parameters
in appHandle

Handle returned by tlc_openSession()

Return values
TRDP_DNR_NOT_AVAILABLE
TRDP_DNR_UNKNOWN
TRDP_DNR_ACTIVE
TRDP_DNR_HOSTSFILE

5.6.2.4

no error
enabled, but cache is empty
enabled, cache has values
enabled, hostsfile used (static mode)

tau_getOwnAddr()

EXT_DECL TRDP_IP_ADDR_T tau_getOwnAddr (
TRDP_APP_SESSION_T appHandle )

Function to get the own IP address.
Returns the IP address set by openSession. If it was 0 (INADDR_ANY), the address of the default adapter will be
returned.

Generated by Doxygen

86

File Documentation

Parameters
in appHandle

Handle returned by tlc_openSession()

Return values
own IP address

5.6.2.5

tau_initDnr()

EXT_DECL TRDP_ERR_T tau_initDnr (
TRDP_APP_SESSION_T appHandle,
TRDP_IP_ADDR_T dnsIpAddr,
UINT16 dnsPort,
const CHAR8 ∗ pHostsFileName,
TRDP_DNR_OPTS_T dnsOptions )

Function to init the DNR subsystem Initialize the DNR resolver.
Function to init DNR.
Depending on the supplied options, three operational modes are supported:

1. TRDP_DNR_COMMON_THREAD (default) Expect tlc_process running in a different, separate thread
2. TRDP_DNR_OWN_THREAD For single threaded systems only! Internally call tlc_process()
3. TRDP_DNR_STANDARD_DNS Use standard DNS instead of TCN-DNS. Default dnsPort (= 0) for TCN-DNS
is 17225, for standard DNS it is 53.
Parameters
in appHandle

in
in
in
in

Handle returned by tlc_openSession().

dnsIpAddr

DNS/ECSP IP address.

dnsPort

DNS port number.

pHostsFileName

Optional host file name as ECSP replacement/addition.

dnsOptions

Use existing thread (recommended), use own tlc_process loop or use standard DNS

Return values
TRDP_NO_ERR
TRDP_INIT_ERR

no error
initialisation error

< default DNR/ECSP settings

5.6.2.6

tau_uri2Addr()

EXT_DECL TRDP_ERR_T tau_uri2Addr (
TRDP_APP_SESSION_T appHandle,
Generated by Doxygen

5.7 tau_dnr.h File Reference

87

TRDP_IP_ADDR_T ∗ pAddr,
const TRDP_URI_T pUri )

Function to convert a URI to an IP address.
Receives an URI as input variable and translates this URI to an IP-Address. The URI may specify either a unicast
or a multicast IP-Address.
Parameters
in
appHandle

out
in

Handle returned by tlc_openSession()

pAddr

Pointer to return the IP address

pUri

Pointer to an URI or an IP Address string, NULL==own URI

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_UNRESOLVED_ERR
TRDP_TOPO_ERR

5.7

no error
Parameter error
Could not resolve error
Cache/DB entry is invalid

tau_dnr.h File Reference

TRDP utility interface definitions.
Generated by Doxygen

88

File Documentation

#include "trdp_types.h"
Include dependency graph for tau_dnr.h:

tau_dnr.h

trdp_types.h

vos_mem.h

vos_sock.h

vos_thread.h

iec61375-2-3.h

vos_private.h

vos_types.h

stdint.h

This graph shows which files directly or indirectly include this file:

tau_dnr.h

tau_dnr.c

tau_tti.c

Functions
• EXT_DECL TRDP_ERR_T tau_initDnr (TRDP_APP_SESSION_T appHandle, TRDP_IP_ADDR_T dnsIp←Addr, UINT16 dnsPort, const CHAR8 ∗pHostsFileName, TRDP_DNR_OPTS_T dnsOptions)
Generated by Doxygen

5.7 tau_dnr.h File Reference

89

Function to init DNR.

• EXT_DECL void tau_deInitDnr (TRDP_APP_SESSION_T appHandle)
Release any resources allocated by DNR.

• EXT_DECL TRDP_DNR_STATE_T tau_DNRstatus (TRDP_APP_SESSION_T appHandle)
Function to get the status of DNR.

• EXT_DECL TRDP_IP_ADDR_T tau_getOwnAddr (TRDP_APP_SESSION_T appHandle)
Function to get the own IP address.

• EXT_DECL TRDP_ERR_T tau_uri2Addr (TRDP_APP_SESSION_T appHandle, TRDP_IP_ADDR_T ∗p←Addr, const TRDP_URI_T pUri)
Function to convert a URI to an IP address.

• EXT_DECL TRDP_ERR_T tau_addr2Uri (TRDP_APP_SESSION_T appHandle, TRDP_URI_HOST_T pUri,
TRDP_IP_ADDR_T addr)
Function to convert an IP address to a URI.

5.7.1

Detailed Description

TRDP utility interface definitions.
This module provides the interface to the following utilities
• IP - URI address translation
Note
Project: TCNOpen TRDP prototype stack
Author
Armin-H. Weiss (initial version)
Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.
Id
tau_dnr.h 1755 2018-08-07 12:10:03Z bloehr
BL 2018-08-07: Ticket #183 tau_getOwnIds moved here
BL 2017-07-25: Ticket #125: tau_dnr: TCN DNS support missing
BL 2015-12-14: Ticket #8: DNR client

5.7.2

Function Documentation

5.7.2.1

tau_addr2Uri()

EXT_DECL TRDP_ERR_T tau_addr2Uri (
TRDP_APP_SESSION_T appHandle,
TRDP_URI_HOST_T pUri,
TRDP_IP_ADDR_T addr )

Function to convert an IP address to a URI.
Receives an IP-Address and translates it into the host part of the corresponding URI. Both unicast and multicast
addresses are accepted.

Generated by Doxygen

90

File Documentation

Parameters
in
appHandle

out
in

Handle returned by tlc_openSession().

pUri

Pointer to a string to return the URI host part

addr

IP address, 0==own address

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

no error
Parameter error

Receives an IP-Address and translates it into the host part of the corresponding URI. Both unicast and multicast
addresses are accepted.
Parameters
in
appHandle

out
in

Handle returned by tlc_openSession()

pUri

Pointer to a string to return the URI host part

addr

IP address, 0==own address

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

5.7.2.2

no error
Parameter error

tau_deInitDnr()

EXT_DECL void tau_deInitDnr (
TRDP_APP_SESSION_T appHandle )

Release any resources allocated by DNR.
Parameters
in appHandle

Handle returned by tlc_openSession().

Return values
none Release any resources allocated by DNR.

Parameters
in appHandle

Handle returned by tlc_openSession()

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

no error
Parameter error

Generated by Doxygen

5.7 tau_dnr.h File Reference

5.7.2.3

91

tau_DNRstatus()

EXT_DECL TRDP_DNR_STATE_T tau_DNRstatus (
TRDP_APP_SESSION_T appHandle )

Function to get the status of DNR.
Parameters
in appHandle

Handle returned by tlc_openSession()

Return values
TRDP_DNR_NOT_AVAILABLE
TRDP_DNR_UNKNOWN
TRDP_DNR_ACTIVE
TRDP_DNR_HOSTSFILE

5.7.2.4

no error
enabled, but cache is empty
enabled, cache has values
enabled, hostsfile used (static mode)

tau_getOwnAddr()

EXT_DECL TRDP_IP_ADDR_T tau_getOwnAddr (
TRDP_APP_SESSION_T appHandle )

Function to get the own IP address.
Parameters
in appHandle

Handle returned by tlc_openSession().

Return values
own IP address

Returns the IP address set by openSession. If it was 0 (INADDR_ANY), the address of the default adapter will be
returned.
Parameters
in appHandle

Return values
own IP address

Generated by Doxygen

Handle returned by tlc_openSession()

92

File Documentation

5.7.2.5

tau_initDnr()

EXT_DECL TRDP_ERR_T tau_initDnr (
TRDP_APP_SESSION_T appHandle,
TRDP_IP_ADDR_T dnsIpAddr,
UINT16 dnsPort,
const CHAR8 ∗ pHostsFileName,
TRDP_DNR_OPTS_T dnsOptions )

Function to init DNR.
Parameters
in appHandle

in
in
in
in

Handle returned by tlc_openSession().

dnsIpAddr

DNS/ECSP IP address.

dnsPort

DNS port number.

pHostsFileName

Optional host file name as ECSP replacement/addition.

dnsOptions

Use existing thread (recommended), use own tlc_process loop or use standard DNS

Return values
TRDP_NO_ERR
TRDP_INIT_ERR

no error
initialisation error

Function to init DNR.
Depending on the supplied options, three operational modes are supported:

1. TRDP_DNR_COMMON_THREAD (default) Expect tlc_process running in a different, separate thread
2. TRDP_DNR_OWN_THREAD For single threaded systems only! Internally call tlc_process()
3. TRDP_DNR_STANDARD_DNS Use standard DNS instead of TCN-DNS. Default dnsPort (= 0) for TCN-DNS
is 17225, for standard DNS it is 53.
Parameters
in appHandle

in
in
in
in

Handle returned by tlc_openSession().

dnsIpAddr

DNS/ECSP IP address.

dnsPort

DNS port number.

pHostsFileName

Optional host file name as ECSP replacement/addition.

dnsOptions

Use existing thread (recommended), use own tlc_process loop or use standard DNS

Return values
TRDP_NO_ERR
TRDP_INIT_ERR

no error
initialisation error

< default DNR/ECSP settings

Generated by Doxygen

5.8 tau_dnr_types.h File Reference

5.7.2.6

93

tau_uri2Addr()

EXT_DECL TRDP_ERR_T tau_uri2Addr (
TRDP_APP_SESSION_T appHandle,
TRDP_IP_ADDR_T ∗ pAddr,
const TRDP_URI_T pUri )

Function to convert a URI to an IP address.
Receives a URI as input variable and translates this URI to an IP-Address. The URI may specify either a unicast or
a multicast IP-Address. The caller may specify a topographic counter, which will be checked.
Parameters
in
appHandle

out
in

Handle returned by tlc_openSession().

pAddr

Pointer to return the IP address

pUri

Pointer to a URI or an IP Address string, NULL==own URI

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

no error
Parameter error

Receives an URI as input variable and translates this URI to an IP-Address. The URI may specify either a unicast
or a multicast IP-Address.
Parameters
in
appHandle

out
in

Handle returned by tlc_openSession()

pAddr

Pointer to return the IP address

pUri

Pointer to an URI or an IP Address string, NULL==own URI

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_UNRESOLVED_ERR
TRDP_TOPO_ERR

5.8

no error
Parameter error
Could not resolve error
Cache/DB entry is invalid

tau_dnr_types.h File Reference

TRDP utility interface definitions.
Generated by Doxygen

94

File Documentation

#include "trdp_types.h"
Include dependency graph for tau_dnr_types.h:

tau_dnr_types.h

trdp_types.h

vos_mem.h

vos_sock.h

vos_thread.h

iec61375-2-3.h

vos_private.h

vos_types.h

stdint.h

This graph shows which files directly or indirectly include this file:

tau_dnr_types.h

tau_dnr.c

Data Structures
• struct TCN_URI
Generated by Doxygen

5.8 tau_dnr_types.h File Reference

95

TCN-DNS simplified header structures.

• struct TRDP_DNS_REQUEST
TCN-DNS Request telegram TCN_DNS_REQ_DS.

• struct TRDP_DNS_REPLY
TCN-DNS Reply telegram TCN_DNS_REP_DS.

Typedefs
• typedef struct TCN_URI TCN_URI_T
TCN-DNS simplified header structures.

• typedef struct TRDP_DNS_REQUEST TRDP_DNS_REQUEST_T
TCN-DNS Request telegram TCN_DNS_REQ_DS.

• typedef struct TRDP_DNS_REPLY TRDP_DNS_REPLY_T
TCN-DNS Reply telegram TCN_DNS_REP_DS.

5.8.1

Detailed Description

TRDP utility interface definitions.
This module provides typedefs to the following utilities

• IP - URI address translation

Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Löhr (initial version)

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
NewTec GmbH, 2017. All rights reserved.

Id

BL 2017-11-13: Ticket #176 TRDP_LABEL_T breaks field alignment -> TRDP_NET_LABEL_T
BL 2017-07-25: Ticket #125: TCN-DNR client
Generated by Doxygen

96

5.9

File Documentation

tau_marshall.c File Reference

Marshalling functions for TRDP.

#include
#include
#include
#include
#include
#include


"trdp_types.h"
"trdp_if_light.h"
"trdp_utils.h"
"vos_mem.h"
"tau_marshall.h"

Include dependency graph for tau_marshall.c:

tau_marshall.c

string.h

tau_marshall.h

trdp_if_light.h

trdp_utils.h

trdp_private.h

vos_utils.h

trdp_types.h

vos_mem.h

stddef.h

iec61375-2-3.h

stdio.h

vos_sock.h

vos_thread.h

vos_private.h

vos_types.h

stdint.h

Data Structures
• struct TAU_MARSHALL_INFO_T
Marshalling info, used to and from wire.

Functions
• EXT_DECL TRDP_ERR_T tau_initMarshall (void ∗∗ppRefCon, UINT32 numComId, TRDP_COMID_DSID←_MAP_T ∗pComIdDsIdMap, UINT32 numDataSet, TRDP_DATASET_T ∗pDataset[ ])
Function to initialise the marshalling/unmarshalling.

• EXT_DECL TRDP_ERR_T tau_marshall (void ∗pRefCon, UINT32 comId, UINT8 ∗pSrc, UINT32 srcSize,
UINT8 ∗pDest, UINT32 ∗pDestSize, TRDP_DATASET_T ∗∗ppDSPointer)
marshall function.

• EXT_DECL TRDP_ERR_T tau_unmarshall (void ∗pRefCon, UINT32 comId, UINT8 ∗pSrc, UINT32 srcSize,
UINT8 ∗pDest, UINT32 ∗pDestSize, TRDP_DATASET_T ∗∗ppDSPointer)
unmarshall function.

• EXT_DECL TRDP_ERR_T tau_marshallDs (void ∗pRefCon, UINT32 dsId, UINT8 ∗pSrc, UINT32 srcSize,
UINT8 ∗pDest, UINT32 ∗pDestSize, TRDP_DATASET_T ∗∗ppDSPointer)
marshall data set function.
Generated by Doxygen

5.9 tau_marshall.c File Reference

97

• EXT_DECL TRDP_ERR_T tau_unmarshallDs (void ∗pRefCon, UINT32 dsId, UINT8 ∗pSrc, UINT32 srcSize,
UINT8 ∗pDest, UINT32 ∗pDestSize, TRDP_DATASET_T ∗∗ppDSPointer)
unmarshall data set function.

• EXT_DECL TRDP_ERR_T tau_calcDatasetSize (void ∗pRefCon, UINT32 dsId, UINT8 ∗pSrc, UINT32 src←Size, UINT32 ∗pDestSize, TRDP_DATASET_T ∗∗ppDSPointer)
Calculate data set size by given data set id.

• EXT_DECL TRDP_ERR_T tau_calcDatasetSizeByComId (void ∗pRefCon, UINT32 comId, UINT8 ∗pSrc, U←INT32 srcSize, UINT32 ∗pDestSize, TRDP_DATASET_T ∗∗ppDSPointer)
Calculate data set size by given ComId.

5.9.1

Detailed Description

Marshalling functions for TRDP.
Note
Project: TCNOpen TRDP prototype stack
Author
Bernd Loehr, NewTec GmbH
Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.
Id
tau_marshall.c 1748 2018-07-13 15:59:36Z bloehr
BL
SW
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL

2018-06-20:
2018-06-12:
2018-05-17:
2018-05-15:
2018-05-03:
2018-05-02:
2017-05-08:
2017-05-08:
2016-07-06:
2016-02-11:
2016-02-04:
2016-02-03:
2015-12-14:

Ticket #184: Building with VS 2015: WIN64 and Windows threads (SOCKET instead of INT32)
Ticket #203 Incorrect unmarshalling of datasets containing TIMEDATE64 array
Ticket #197 Incorrect Marshalling/Unmarshalling for nested datasets
Wrong source size/range should not lead to marshalling error, check discarded
Ticket #193 Unused parameter warnings
Ticket #188 Typo in the TRDP_VAR_SIZE definition
Compiler warnings, MISRA-C
Ticket #156 Recursion counter never decremented (+ compiler warnings, MISRA)
Ticket #122 64Bit compatibility (+ compiler warnings), alignment casts fixed
Ticket #108: missing initialisation of size-pointer
Ticket #109: size_marshall -> size_unmarshall
Ticket #108: Uninitialized info variable
Ticket #33: source size check for marshalling

5.9.2

Function Documentation

5.9.2.1

tau_calcDatasetSize()

EXT_DECL TRDP_ERR_T tau_calcDatasetSize (
void ∗ pRefCon,
UINT32 dsId,
UINT8 ∗ pSrc,
UINT32 srcSize,
UINT32 ∗ pDestSize,
TRDP_DATASET_T ∗∗ ppDSPointer )

Calculate data set size by given data set id.

Generated by Doxygen

98

File Documentation

Parameters

in
in
in
in
out
in,out

pRefCon

Pointer to user context

dsId

Dataset id to identify the structure out of a configuration

pSrc

Pointer to received original message

srcSize
pDestSize

size of the source buffer
Pointer to the size of the data set

ppDSPointer

pointer to pointer to cached dataset, set NULL if not used, set content NULL if
unknown

Return values
TRDP_INIT_ERR
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

no error
provided buffer to small
Parameter error

TRDP_STATE_ERR

Too deep recursion

TRDP_COMID_ERR

comid not existing

TRDP_MARSHALLING_ERR

5.9.2.2

marshalling not initialised

dataset/source size mismatch

tau_calcDatasetSizeByComId()

EXT_DECL TRDP_ERR_T tau_calcDatasetSizeByComId (
void ∗ pRefCon,
UINT32 comId,
UINT8 ∗ pSrc,
UINT32 srcSize,
UINT32 ∗ pDestSize,
TRDP_DATASET_T ∗∗ ppDSPointer )

Calculate data set size by given ComId.
Parameters

in
in
in
in
out
in,out

pRefCon

Pointer to user context

comId

ComId id to identify the structure out of a configuration

pSrc

Pointer to received original message

srcSize
pDestSize

size of the source buffer
Pointer to the size of the data set

ppDSPointer

pointer to pointer to cached dataset, set NULL if not used, set content NULL if
unknown

Return values
TRDP_INIT_ERR
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR
TRDP_STATE_ERR

marshalling not initialised
no error
provided buffer to small
Parameter error
Too deep recursion

Generated by Doxygen

5.9 tau_marshall.c File Reference
Return values
TRDP_COMID_ERR

comid not existing

TRDP_MARSHALLING_ERR

5.9.2.3

99

dataset/source size mismatch

tau_initMarshall()

EXT_DECL TRDP_ERR_T tau_initMarshall (
void ∗∗ ppRefCon,
UINT32 numComId,
TRDP_COMID_DSID_MAP_T ∗ pComIdDsIdMap,
UINT32 numDataSet,
TRDP_DATASET_T ∗ pDataset[ ] )

Function to initialise the marshalling/unmarshalling.
Types for marshalling / unmarshalling.
The supplied array must be sorted by ComIds. The array must exist during the use of the marshalling functions
(until tlc_terminate()).
Parameters

in,out

ppRefCon

Returns a pointer to be used for the reference context of
marshalling/unmarshalling

in
in
in
in

numComId

Number of datasets found in the configuration

pComIdDsIdMap

Pointer to an array of structures of type TRDP_DATASET_T

numDataSet

Number of datasets found in the configuration

pDataset

Pointer to an array of pointers to structures of type TRDP_DATASET_T

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

5.9.2.4

no error
provided buffer to small
Parameter error

tau_marshall()

EXT_DECL TRDP_ERR_T tau_marshall (
void ∗ pRefCon,
UINT32 comId,
UINT8 ∗ pSrc,
UINT32 srcSize,
UINT8 ∗ pDest,
UINT32 ∗ pDestSize,
TRDP_DATASET_T ∗∗ ppDSPointer )

marshall function.

Generated by Doxygen

100

File Documentation

Parameters

in
in
in
in
in
in,out
in,out

pRefCon

pointer to user context

comId

ComId to identify the structure out of a configuration

pSrc

pointer to received original message

srcSize
pDest

size of the source buffer
pointer to a buffer for the treated message

pDestSize

size of the provide buffer / size of the treated message

ppDSPointer

pointer to pointer to cached dataset set NULL if not used, set content NULL if unknown

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR
TRDP_STATE_ERR
TRDP_MARSHALLING_ERR

5.9.2.5

no error
provided buffer to small
Parameter error
Too deep recursion
dataset/source size mismatch

tau_marshallDs()

EXT_DECL TRDP_ERR_T tau_marshallDs (
void ∗ pRefCon,
UINT32 dsId,
UINT8 ∗ pSrc,
UINT32 srcSize,
UINT8 ∗ pDest,
UINT32 ∗ pDestSize,
TRDP_DATASET_T ∗∗ ppDSPointer )

marshall data set function.
Parameters

in
in
in
in
in
in,out
in,out

pRefCon

pointer to user context

dsId

Data set id to identify the structure out of a configuration

pSrc

pointer to received original message

srcSize
pDest

size of the source buffer
pointer to a buffer for the treated message

pDestSize

size of the provide buffer / size of the treated message

ppDSPointer

pointer to pointer to cached dataset set NULL if not used, set content NULL if unknown

Return values
TRDP_INIT_ERR
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

marshalling not initialised
no error
provided buffer to small
Parameter error

TRDP_STATE_ERR

Too deep recursion

TRDP_COMID_ERR

comid not existing
Generated by Doxygen

5.9 tau_marshall.c File Reference
Return values
TRDP_MARSHALLING_ERR

5.9.2.6

101

dataset/source size mismatch

tau_unmarshall()

EXT_DECL TRDP_ERR_T tau_unmarshall (
void ∗ pRefCon,
UINT32 comId,
UINT8 ∗ pSrc,
UINT32 srcSize,
UINT8 ∗ pDest,
UINT32 ∗ pDestSize,
TRDP_DATASET_T ∗∗ ppDSPointer )

unmarshall function.
Parameters

in
in
in
in
in
in,out
in,out

pRefCon

pointer to user context

comId

ComId to identify the structure out of a configuration

pSrc

pointer to received original message

srcSize
pDest

size of the source buffer
pointer to a buffer for the treated message

pDestSize

size of the provide buffer / size of the treated message

ppDSPointer

pointer to pointer to cached dataset set NULL if not used, set content NULL if unknown

Return values
TRDP_INIT_ERR
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

no error
provided buffer to small
Parameter error

TRDP_STATE_ERR

Too deep recursion

TRDP_COMID_ERR

comid not existing

TRDP_MARSHALLING_ERR

5.9.2.7

marshalling not initialised

dataset/source size mismatch

tau_unmarshallDs()

EXT_DECL TRDP_ERR_T tau_unmarshallDs (
void ∗ pRefCon,
UINT32 dsId,
UINT8 ∗ pSrc,
UINT32 srcSize,
UINT8 ∗ pDest,
Generated by Doxygen

102

File Documentation

UINT32 ∗ pDestSize,
TRDP_DATASET_T ∗∗ ppDSPointer )

unmarshall data set function.
Parameters

in
in
in
in
in
in,out
in,out

pRefCon

pointer to user context

dsId

Data set id to identify the structure out of a configuration

pSrc

pointer to received original message

srcSize
pDest

size of the source buffer
pointer to a buffer for the treated message

pDestSize

size of the provide buffer / size of the treated message

ppDSPointer

pointer to pointer to cached dataset set NULL if not used, set content NULL if unknown

Return values
TRDP_INIT_ERR
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

no error
provided buffer to small
Parameter error

TRDP_STATE_ERR

Too deep recursion

TRDP_COMID_ERR

comid not existing

TRDP_MARSHALLING_ERR

5.10

marshalling not initialised

dataset/source size mismatch

tau_marshall.h File Reference

TRDP utility interface definitions.
Generated by Doxygen

5.10 tau_marshall.h File Reference

103

#include "trdp_types.h"
Include dependency graph for tau_marshall.h:

tau_marshall.h

trdp_types.h

vos_mem.h

vos_sock.h

vos_thread.h

iec61375-2-3.h

vos_private.h

vos_types.h

stdint.h

This graph shows which files directly or indirectly include this file:

tau_marshall.h

tau_marshall.c

tau_tti.c

Functions
• EXT_DECL TRDP_ERR_T tau_initMarshall (void ∗∗ppRefCon, UINT32 numComId, TRDP_COMID_DSID←_MAP_T ∗pComIdDsIdMap, UINT32 numDataSet, TRDP_DATASET_T ∗pDataset[ ])
Generated by Doxygen

104

File Documentation

Types for marshalling / unmarshalling.

• EXT_DECL TRDP_ERR_T tau_marshall (void ∗pRefCon, UINT32 comId, UINT8 ∗pSrc, UINT32 srcSize,
UINT8 ∗pDest, UINT32 ∗pDestSize, TRDP_DATASET_T ∗∗ppDSPointer)
marshall function.

• EXT_DECL TRDP_ERR_T tau_marshallDs (void ∗pRefCon, UINT32 dsId, UINT8 ∗pSrc, UINT32 srcSize,
UINT8 ∗pDest, UINT32 ∗pDestSize, TRDP_DATASET_T ∗∗ppDSPointer)
marshall data set function.

• EXT_DECL TRDP_ERR_T tau_unmarshall (void ∗pRefCon, UINT32 comId, UINT8 ∗pSrc, UINT32 srcSize,
UINT8 ∗pDest, UINT32 ∗pDestSize, TRDP_DATASET_T ∗∗ppDSPointer)
unmarshall function.

• EXT_DECL TRDP_ERR_T tau_unmarshallDs (void ∗pRefCon, UINT32 dsId, UINT8 ∗pSrc, UINT32 srcSize,
UINT8 ∗pDest, UINT32 ∗pDestSize, TRDP_DATASET_T ∗∗ppDSPointer)
unmarshall data set function.

• EXT_DECL TRDP_ERR_T tau_calcDatasetSize (void ∗pRefCon, UINT32 dsId, UINT8 ∗pSrc, UINT32 src←Size, UINT32 ∗pDestSize, TRDP_DATASET_T ∗∗ppDSPointer)
Calculate data set size by given data set id.

• EXT_DECL TRDP_ERR_T tau_calcDatasetSizeByComId (void ∗pRefCon, UINT32 comId, UINT8 ∗pSrc, U←INT32 srcSize, UINT32 ∗pDestSize, TRDP_DATASET_T ∗∗ppDSPointer)
Calculate data set size by given ComId.

5.10.1

Detailed Description

TRDP utility interface definitions.
This module provides the interface to the following utilities
• marshalling/unmarshalling

Note
Project: TCNOpen TRDP prototype stack

Author
Armin-H. Weiss

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.
Id
tau_marshall.h 1479 2015-12-14 14:53:45Z bloehr
BL 2015-12-14: Ticket #33: source size check for marshalling

5.10.2

Function Documentation

Generated by Doxygen

5.10 tau_marshall.h File Reference

5.10.2.1

tau_calcDatasetSize()

EXT_DECL TRDP_ERR_T tau_calcDatasetSize (
void ∗ pRefCon,
UINT32 dsId,
UINT8 ∗ pSrc,
UINT32 srcSize,
UINT32 ∗ pDestSize,
TRDP_DATASET_T ∗∗ ppDSPointer )

Calculate data set size by given data set id.
Parameters

in
in
in
in
out
in,out

pRefCon

Pointer to user context

dsId

Dataset id to identify the structure out of a configuration

pSrc

Pointer to received original message

srcSize
pDestSize

size of the source buffer
Pointer to the size of the data set

ppDSPointer

pointer to pointer to cached dataset, set NULL if not used, set content NULL if
unknown

Return values
TRDP_NO_ERR
TRDP_INIT_ERR
TRDP_PARAM_ERR

no error
marshalling not initialised
data set id not existing

Parameters

in
in
in
in
out
in,out

pRefCon

Pointer to user context

dsId

Dataset id to identify the structure out of a configuration

pSrc

Pointer to received original message

srcSize
pDestSize

size of the source buffer
Pointer to the size of the data set

ppDSPointer

pointer to pointer to cached dataset, set NULL if not used, set content NULL if
unknown

Return values
TRDP_INIT_ERR
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

marshalling not initialised
no error
provided buffer to small
Parameter error

TRDP_STATE_ERR

Too deep recursion

TRDP_COMID_ERR

comid not existing

TRDP_MARSHALLING_ERR

Generated by Doxygen

dataset/source size mismatch

105

106

File Documentation

5.10.2.2

tau_calcDatasetSizeByComId()

EXT_DECL TRDP_ERR_T tau_calcDatasetSizeByComId (
void ∗ pRefCon,
UINT32 comId,
UINT8 ∗ pSrc,
UINT32 srcSize,
UINT32 ∗ pDestSize,
TRDP_DATASET_T ∗∗ ppDSPointer )

Calculate data set size by given ComId.
Parameters

in
in
in
in
out
in,out

pRefCon

Pointer to user context

comId

ComId id to identify the structure out of a configuration

pSrc

Pointer to received original message

srcSize
pDestSize

size of the source buffer
Pointer to the size of the data set

ppDSPointer

pointer to pointer to cached dataset, set NULL if not used, set content NULL if
unknown

Return values
TRDP_NO_ERR
TRDP_INIT_ERR
TRDP_PARAM_ERR

no error
marshalling not initialised
data set id not existing

Parameters

in
in
in
in
out
in,out

pRefCon

Pointer to user context

comId

ComId id to identify the structure out of a configuration

pSrc

Pointer to received original message

srcSize
pDestSize

size of the source buffer
Pointer to the size of the data set

ppDSPointer

pointer to pointer to cached dataset, set NULL if not used, set content NULL if
unknown

Return values
TRDP_INIT_ERR
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

marshalling not initialised
no error
provided buffer to small
Parameter error

TRDP_STATE_ERR

Too deep recursion

TRDP_COMID_ERR

comid not existing

TRDP_MARSHALLING_ERR

dataset/source size mismatch

Generated by Doxygen

5.10 tau_marshall.h File Reference

5.10.2.3

107

tau_initMarshall()

EXT_DECL TRDP_ERR_T tau_initMarshall (
void ∗∗ ppRefCon,
UINT32 numComId,
TRDP_COMID_DSID_MAP_T ∗ pComIdDsIdMap,
UINT32 numDataSet,
TRDP_DATASET_T ∗ pDataset[ ] )

Types for marshalling / unmarshalling.
Function to initialise the marshalling/unmarshalling.
Parameters

in,out

ppRefCon

Returns a pointer to be used for the reference context of
marshalling/unmarshalling

in
in
in
in

numComId

Number of datasets found in the configuration

pComIdDsIdMap

Pointer to an array of structures of type TRDP_DATASET_T

numDataSet

Number of datasets found in the configuration

pDataset

Pointer to an array of pointers to structures of type TRDP_DATASET_T

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

no error
provided buffer to small
Parameter error

Types for marshalling / unmarshalling.
The supplied array must be sorted by ComIds. The array must exist during the use of the marshalling functions
(until tlc_terminate()).
Parameters

in,out

ppRefCon

Returns a pointer to be used for the reference context of
marshalling/unmarshalling

in
in
in
in

numComId

Number of datasets found in the configuration

pComIdDsIdMap

Pointer to an array of structures of type TRDP_DATASET_T

numDataSet

Number of datasets found in the configuration

pDataset

Pointer to an array of pointers to structures of type TRDP_DATASET_T

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

Generated by Doxygen

no error
provided buffer to small
Parameter error

108

File Documentation

5.10.2.4

tau_marshall()

EXT_DECL TRDP_ERR_T tau_marshall (
void ∗ pRefCon,
UINT32 comId,
UINT8 ∗ pSrc,
UINT32 srcSize,
UINT8 ∗ pDest,
UINT32 ∗ pDestSize,
TRDP_DATASET_T ∗∗ ppDSPointer )

marshall function.
Parameters

in
in
in
in
in
in,out
in,out

pRefCon

pointer to user context

comId

ComId to identify the structure out of a configuration

pSrc

pointer to received original message

srcSize
pDest

size of the source buffer
pointer to a buffer for the treated message

pDestSize

size of the provide buffer / size of the treated message

ppDSPointer

pointer to pointer to cached dataset set NULL if not used, set content NULL if unknown

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_INIT_ERR

no error
provided buffer to small
marshalling not initialised

TRDP_COMID_ERR

comid not existing

TRDP_PARAM_ERR

Parameter error

Parameters

in
in
in
in
in
in,out
in,out

pRefCon

pointer to user context

comId

ComId to identify the structure out of a configuration

pSrc

pointer to received original message

srcSize
pDest

size of the source buffer
pointer to a buffer for the treated message

pDestSize

size of the provide buffer / size of the treated message

ppDSPointer

pointer to pointer to cached dataset set NULL if not used, set content NULL if unknown

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR
TRDP_STATE_ERR
TRDP_MARSHALLING_ERR

no error
provided buffer to small
Parameter error
Too deep recursion
dataset/source size mismatch

Generated by Doxygen

5.10 tau_marshall.h File Reference

5.10.2.5

109

tau_marshallDs()

EXT_DECL TRDP_ERR_T tau_marshallDs (
void ∗ pRefCon,
UINT32 dsId,
UINT8 ∗ pSrc,
UINT32 srcSize,
UINT8 ∗ pDest,
UINT32 ∗ pDestSize,
TRDP_DATASET_T ∗∗ ppDSPointer )

marshall data set function.
Parameters

in
in
in
in
in
in,out
in,out

pRefCon

pointer to user context

dsId

Data set id to identify the structure out of a configuration

pSrc

pointer to received original message

srcSize
pDest

size of the source buffer
pointer to a buffer for the treated message

pDestSize

size of the provide buffer / size of the treated message

ppDSPointer

pointer to pointer to cached dataset set NULL if not used, set content NULL if unknown

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_INIT_ERR

no error
provided buffer to small
marshalling not initialised

TRDP_COMID_ERR

comid not existing

TRDP_PARAM_ERR

Parameter error

Parameters

in
in
in
in
in
in,out
in,out

pRefCon

pointer to user context

dsId

Data set id to identify the structure out of a configuration

pSrc

pointer to received original message

srcSize
pDest

size of the source buffer
pointer to a buffer for the treated message

pDestSize

size of the provide buffer / size of the treated message

ppDSPointer

pointer to pointer to cached dataset set NULL if not used, set content NULL if unknown

Return values
TRDP_INIT_ERR
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

marshalling not initialised
no error
provided buffer to small
Parameter error

TRDP_STATE_ERR

Too deep recursion

TRDP_COMID_ERR

comid not existing

TRDP_MARSHALLING_ERR

Generated by Doxygen

dataset/source size mismatch

110

File Documentation

5.10.2.6

tau_unmarshall()

EXT_DECL TRDP_ERR_T tau_unmarshall (
void ∗ pRefCon,
UINT32 comId,
UINT8 ∗ pSrc,
UINT32 srcSize,
UINT8 ∗ pDest,
UINT32 ∗ pDestSize,
TRDP_DATASET_T ∗∗ ppDSPointer )

unmarshall function.
Parameters

in
in
in
in
in
in,out
in,out

pRefCon

pointer to user context

comId

ComId to identify the structure out of a configuration

pSrc

pointer to received original message

srcSize
pDest

size of the source buffer
pointer to a buffer for the treated message

pDestSize

size of the provide buffer / size of the treated message

ppDSPointer

pointer to pointer to cached dataset set NULL if not used, set content NULL if unknown

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_INIT_ERR
TRDP_COMID_ERR

no error
provided buffer to small
marshalling not initialised
comid not existing

Parameters

in
in
in
in
in
in,out
in,out

pRefCon

pointer to user context

comId

ComId to identify the structure out of a configuration

pSrc

pointer to received original message

srcSize
pDest

size of the source buffer
pointer to a buffer for the treated message

pDestSize

size of the provide buffer / size of the treated message

ppDSPointer

pointer to pointer to cached dataset set NULL if not used, set content NULL if unknown

Return values
TRDP_INIT_ERR
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

marshalling not initialised
no error
provided buffer to small
Parameter error

TRDP_STATE_ERR

Too deep recursion

TRDP_COMID_ERR

comid not existing

TRDP_MARSHALLING_ERR

dataset/source size mismatch
Generated by Doxygen

5.10 tau_marshall.h File Reference

5.10.2.7

111

tau_unmarshallDs()

EXT_DECL TRDP_ERR_T tau_unmarshallDs (
void ∗ pRefCon,
UINT32 dsId,
UINT8 ∗ pSrc,
UINT32 srcSize,
UINT8 ∗ pDest,
UINT32 ∗ pDestSize,
TRDP_DATASET_T ∗∗ ppDSPointer )

unmarshall data set function.
Parameters

in
in
in
in
in
in,out
in,out

pRefCon

pointer to user context

dsId

Data set id to identify the structure out of a configuration

pSrc

pointer to received original message

srcSize
pDest

size of the source buffer
pointer to a buffer for the treated message

pDestSize

size of the provide buffer / size of the treated message

ppDSPointer

pointer to pointer to cached dataset set NULL if not used, set content NULL if unknown

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_INIT_ERR
TRDP_COMID_ERR

no error
provided buffer to small
marshalling not initialised
comid not existing

Parameters

in
in
in
in
in
in,out
in,out

pRefCon

pointer to user context

dsId

Data set id to identify the structure out of a configuration

pSrc

pointer to received original message

srcSize
pDest

size of the source buffer
pointer to a buffer for the treated message

pDestSize

size of the provide buffer / size of the treated message

ppDSPointer

pointer to pointer to cached dataset set NULL if not used, set content NULL if unknown

Return values
TRDP_INIT_ERR
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

marshalling not initialised
no error
provided buffer to small
Parameter error

TRDP_STATE_ERR

Too deep recursion

TRDP_COMID_ERR

comid not existing

TRDP_MARSHALLING_ERR
Generated by Doxygen

dataset/source size mismatch

112

File Documentation

5.11

tau_tti.c File Reference

Functions for train topology information access.

#include
#include
#include
#include
#include
#include
#include
#include
#include



"trdp_if_light.h"
"trdp_utils.h"
"tau_marshall.h"
"tau_tti.h"
"vos_sock.h"
"tau_dnr.h"
"tau_cstinfo.c"

Include dependency graph for tau_tti.c:

tau_tti.c

tau_cstinfo.c

string.h

trdp_utils.h

trdp_if_light.h

vos_utils.h

stdio.h

tau_marshall.h

tau_dnr.h

tau_tti.h

trdp_private.h

tau_tti_types.h

stddef.h

trdp_types.h

vos_sock.h

vos_private.h

vos_mem.h

iec61375-2-3.h

vos_thread.h

vos_types.h

stdint.h

Macros
• #define TTI_CACHED_CONSISTS 8u
We hold this number of consist infos (ca.

Functions
• EXT_DECL TRDP_ERR_T tau_initTTIaccess (TRDP_APP_SESSION_T appHandle, VOS_SEMA_T user←Action, TRDP_IP_ADDR_T ecspIpAddr, CHAR8 ∗hostsFileName)
Function to init TTI access.

• EXT_DECL void tau_deInitTTI (TRDP_APP_SESSION_T appHandle)
Release any resources allocated by TTI Must be called before closing the session.

• EXT_DECL TRDP_ERR_T tau_getOpTrDirectory (TRDP_APP_SESSION_T appHandle, TRDP_OP_TRA←IN_DIR_STATE_T ∗pOpTrnDirState, TRDP_OP_TRAIN_DIR_T ∗pOpTrnDir)
Function to retrieve the operational train directory state.

Generated by Doxygen

5.11 tau_tti.c File Reference

113

• EXT_DECL TRDP_ERR_T tau_getOpTrnDirectoryStatusInfo (TRDP_APP_SESSION_T appHandle, TRD←P_OP_TRAIN_DIR_STATUS_INFO_T ∗pOpTrnDirStatusInfo)
Function to retrieve the operational train directory state info.

• EXT_DECL TRDP_ERR_T tau_getTrDirectory (TRDP_APP_SESSION_T appHandle, TRDP_TRAIN_DIR←_T ∗pTrnDir)
Function to retrieve the train directory.

• EXT_DECL TRDP_ERR_T tau_getStaticCstInfo (TRDP_APP_SESSION_T appHandle, TRDP_CONSIST←_INFO_T ∗pCstInfo, TRDP_UUID_T const cstUUID)
Function to retrieve the consist info.

• EXT_DECL TRDP_ERR_T tau_getTTI (TRDP_APP_SESSION_T appHandle, TRDP_OP_TRAIN_DIR_S←TATE_T ∗pOpTrnDirState, TRDP_OP_TRAIN_DIR_T ∗pOpTrnDir, TRDP_TRAIN_DIR_T ∗pTrnDir, TRDP←_TRAIN_NET_DIR_T ∗pTrnNetDir)
Function to retrieve the operational train directory.

• EXT_DECL TRDP_ERR_T tau_getTrnCstCnt (TRDP_APP_SESSION_T appHandle, UINT16 ∗pTrnCstCnt)
Function to retrieve the total number of consists in the train.

• EXT_DECL TRDP_ERR_T tau_getTrnVehCnt (TRDP_APP_SESSION_T appHandle, UINT16 ∗pTrnVehCnt)
Function to retrieve the total number of vehicles in the train.

• EXT_DECL TRDP_ERR_T tau_getCstVehCnt (TRDP_APP_SESSION_T appHandle, UINT16 ∗pCstVehCnt,
const TRDP_LABEL_T pCstLabel)
Function to retrieve the total number of vehicles in a consist.

• EXT_DECL TRDP_ERR_T tau_getCstFctCnt (TRDP_APP_SESSION_T appHandle, UINT16 ∗pCstFctCnt,
const TRDP_LABEL_T pCstLabel)
Function to retrieve the total number of functions in a consist.

• EXT_DECL TRDP_ERR_T tau_getCstFctInfo (TRDP_APP_SESSION_T appHandle, TRDP_FUNCTION_←INFO_T ∗pFctInfo, const TRDP_LABEL_T pCstLabel, UINT16 maxFctCnt)
Function to retrieve the function information of the consist.

• EXT_DECL TRDP_ERR_T tau_getVehInfo (TRDP_APP_SESSION_T appHandle, TRDP_VEHICLE_INF←O_T ∗pVehInfo, const TRDP_LABEL_T pVehLabel, const TRDP_LABEL_T pCstLabel)
Function to retrieve the vehicle information of a consist's vehicle.

• EXT_DECL TRDP_ERR_T tau_getCstInfo (TRDP_APP_SESSION_T appHandle, TRDP_CONSIST_INF←O_T ∗pCstInfo, const TRDP_LABEL_T pCstLabel)
Function to retrieve the consist information of a train's consist.

• EXT_DECL TRDP_ERR_T tau_getVehOrient (TRDP_APP_SESSION_T appHandle, UINT8 ∗pVehOrient,
UINT8 ∗pCstOrient, TRDP_LABEL_T pVehLabel, TRDP_LABEL_T pCstLabel)
Function to retrieve the orientation of the given vehicle.

• EXT_DECL TRDP_ERR_T tau_getOwnIds (TRDP_APP_SESSION_T appHandle, TRDP_LABEL_T ∗p←DevId, TRDP_LABEL_T ∗pVehId, TRDP_LABEL_T ∗pCstId)
Who am I ?.

5.11.1

Detailed Description

Functions for train topology information access.
The TTI subsystem maintains a pointer to the TAU_TTDB struct in the TRDP session struct. That TAU_TTDB
struct keeps the subscription and listener handles, the current TTDB directories and a pointer list to consist infos
(in network format). On init, most TTDB data is requested from the ECSP plus the own consist info. This data
is automatically updated if an inauguration is detected. Additional consist infos are requested on demand, only.
Because of the asynchronous behavior of the TTI subsystem, most functions in tau_tti.c may return TRDP_N←ODATA_ERR on first invocation. They should be called again after 1...3 seconds (3s is the timeout for most MD
replies).

Generated by Doxygen

114

File Documentation

Note
Project: TCNOpen TRDP prototype stack

Author
B. Loehr (initial version)

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2016. All rights reserved.
Id
tau_tti.c 1755 2018-08-07 12:10:03Z bloehr
BL
BL
BL
BL
AHW
BL
BL
BL
BL
BL
BL

2018-08-07:
2018-06-20:
2017-11-28:
2017-11-13:
2017-11-08:
2017-05-08:
2017-04-28:
2017-03-13:
2017-02-10:
2017-02-08:
2016-02-18:

Ticket #183 tau_getOwnIds declared but not defined
Ticket #184: Building with VS 2015: WIN64 and Windows threads (SOCKET instead of INT32)
Ticket #180 Filtering rules for DestinationURI does not follow the standard
Ticket #176 TRDP_LABEL_T breaks field alignment -> TRDP_NET_LABEL_T
Ticket #179 Max. number of retries (part of sendParam) of a MD request needs to be checked
Compiler warnings, doxygen comment errors
Ticket #155: Kill trdp_proto.h - move definitions to iec61375-2-3.h
Ticket #154 ComIds and DSIds literals (#define TRDP_...) in trdp_proto.h too long
Ticket #129 Found a bug which yields wrong output params and potentially segfaults
Ticket #142 Compiler warnings / MISRA-C 2012 issues
Ticket #7: Add train topology information support

5.11.2

Macro Definition Documentation

5.11.2.1

TTI_CACHED_CONSISTS

#define TTI_CACHED_CONSISTS 8u

We hold this number of consist infos (ca.
105kB)

5.11.3

Function Documentation

5.11.3.1

tau_deInitTTI()

EXT_DECL void tau_deInitTTI (
TRDP_APP_SESSION_T appHandle )

Release any resources allocated by TTI Must be called before closing the session.
Function to terminate TTI access.

Generated by Doxygen

5.11 tau_tti.c File Reference
Parameters
in appHandle

Handle returned by tlc_openSession().

Return values
none

5.11.3.2

tau_getCstFctCnt()

EXT_DECL TRDP_ERR_T tau_getCstFctCnt (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pCstFctCnt,
const TRDP_LABEL_T pCstLabel )

Function to retrieve the total number of functions in a consist.
Parameters
in
appHandle

out
in

Handle returned by tlc_openSession().

pCstFctCnt

Pointer to the number of functions to be returned

pCstLabel

Pointer to a consist label. NULL means own consist.

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

5.11.3.3

Parameter error

tau_getCstFctInfo()

EXT_DECL TRDP_ERR_T tau_getCstFctInfo (
TRDP_APP_SESSION_T appHandle,
TRDP_FUNCTION_INFO_T ∗ pFctInfo,
const TRDP_LABEL_T pCstLabel,
UINT16 maxFctCnt )

Function to retrieve the function information of the consist.
Parameters
in
appHandle

Handle returned by tlc_openSession().

out

pFctInfo

in
in

pCstLabel

Pointer to function info list to be returned. Memory needs to be provided by application.
Set NULL if not used.
Pointer to a consist label. NULL means own consist.

maxFctCnt

Maximal number of functions to be returned in provided buffer.

Generated by Doxygen

115

116

File Documentation

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

5.11.3.4

Parameter error

tau_getCstInfo()

EXT_DECL TRDP_ERR_T tau_getCstInfo (
TRDP_APP_SESSION_T appHandle,
TRDP_CONSIST_INFO_T ∗ pCstInfo,
const TRDP_LABEL_T pCstLabel )

Function to retrieve the consist information of a train's consist.
Parameters
in
appHandle

out
in

Handle returned by tlc_openSession().

pCstInfo

Pointer to the consist info to be returned.

pCstLabel

Pointer to a consist label. NULL means own consist.

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

5.11.3.5

Parameter error

tau_getCstVehCnt()

EXT_DECL TRDP_ERR_T tau_getCstVehCnt (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pCstVehCnt,
const TRDP_LABEL_T pCstLabel )

Function to retrieve the total number of vehicles in a consist.
Parameters
in
appHandle

out
in

Handle returned by tlc_openSession().

pCstVehCnt

Pointer to the number of vehicles to be returned

pCstLabel

Pointer to a consist label. NULL means own consist.

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_NODATA_ERR

no error
Parameter error
Try again

Generated by Doxygen

5.11 tau_tti.c File Reference

5.11.3.6

117

tau_getOpTrDirectory()

EXT_DECL TRDP_ERR_T tau_getOpTrDirectory (
TRDP_APP_SESSION_T appHandle,
TRDP_OP_TRAIN_DIR_STATE_T ∗ pOpTrnDirState,
TRDP_OP_TRAIN_DIR_T ∗ pOpTrnDir )

Function to retrieve the operational train directory state.
Parameters
in
appHandle

out
out

pOpTrnDirState

Pointer to an operational train directory state structure to be returned.

pOpTrnDir

Pointer to an operational train directory structure to be returned.

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_NODATA_ERR

5.11.3.7

Handle returned by tlc_openSession().

no error
Parameter error
Data currently not available, try again later

tau_getOpTrnDirectoryStatusInfo()

EXT_DECL TRDP_ERR_T tau_getOpTrnDirectoryStatusInfo (
TRDP_APP_SESSION_T appHandle,
TRDP_OP_TRAIN_DIR_STATUS_INFO_T ∗ pOpTrnDirStatusInfo )

Function to retrieve the operational train directory state info.
Return a copy of the last received PD 100 telegram. Note: The values are in host endianess! When validating
(SDTv2), network endianess must be ensured.
Parameters
in
appHandle

out

Handle returned by tlc_openSession().

pOpTrnDirStatusInfo

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

Generated by Doxygen

Pointer to an operational train directory state structure to be returned.

no error
Parameter error

118

5.11.3.8

File Documentation

tau_getOwnIds()

EXT_DECL TRDP_ERR_T tau_getOwnIds (
TRDP_APP_SESSION_T appHandle,
TRDP_LABEL_T ∗ pDevId,
TRDP_LABEL_T ∗ pVehId,
TRDP_LABEL_T ∗ pCstId )

Who am I ?.
Realizes a kind of 'Who am I' function. It is used to determine the own identifiers (i.e. the own labels), which may
be used as host part of the own fully qualified domain name.
Parameters
in
appHandle

out
out
out

Handle returned by tlc_openSession()

pDevId

Returns the device label (host name)

pVehId

Returns the vehicle label

pCstId

Returns the consist label

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_NODATA_ERR

5.11.3.9

no error
Parameter error
Data currently not available, call again

tau_getStaticCstInfo()

EXT_DECL TRDP_ERR_T tau_getStaticCstInfo (
TRDP_APP_SESSION_T appHandle,
TRDP_CONSIST_INFO_T ∗ pCstInfo,
TRDP_UUID_T const cstUUID )

Function to retrieve the consist info.
Function to retrieve the operational train directory.
Parameters
in
appHandle

out
in

Handle returned by tlc_openSession().

pCstInfo

Pointer to a consist info structure to be returned.

cstUUID

UUID of the consist the consist info is rquested for.

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

no error
Parameter error

Generated by Doxygen

5.11 tau_tti.c File Reference

5.11.3.10

tau_getTrDirectory()

EXT_DECL TRDP_ERR_T tau_getTrDirectory (
TRDP_APP_SESSION_T appHandle,
TRDP_TRAIN_DIR_T ∗ pTrnDir )

Function to retrieve the train directory.
Function to retrieve the operational train directory.
Parameters
in
appHandle

out

pTrnDir

Handle returned by tlc_openSession().
Pointer to a train directory structure to be returned.

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_NODATA_ERR

5.11.3.11

no error
Parameter error
Try later

tau_getTrnCstCnt()

EXT_DECL TRDP_ERR_T tau_getTrnCstCnt (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pTrnCstCnt )

Function to retrieve the total number of consists in the train.
Parameters
in
appHandle

out

pTrnCstCnt

Handle returned by tlc_openSession().
Pointer to the number of consists to be returned

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_NODATA_ERR

5.11.3.12

no error
Parameter error
Try again

tau_getTrnVehCnt()

EXT_DECL TRDP_ERR_T tau_getTrnVehCnt (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pTrnVehCnt )

Function to retrieve the total number of vehicles in the train.

Generated by Doxygen

119

120

File Documentation

Parameters
in
appHandle

out

pTrnVehCnt

Handle returned by tlc_openSession().
Pointer to the number of vehicles to be returned

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_NODATA_ERR

5.11.3.13

no error
Parameter error
Try again

tau_getTTI()

EXT_DECL TRDP_ERR_T tau_getTTI (
TRDP_APP_SESSION_T appHandle,
TRDP_OP_TRAIN_DIR_STATE_T ∗ pOpTrnDirState,
TRDP_OP_TRAIN_DIR_T ∗ pOpTrnDir,
TRDP_TRAIN_DIR_T ∗ pTrnDir,
TRDP_TRAIN_NET_DIR_T ∗ pTrnNetDir )

Function to retrieve the operational train directory.
Parameters
in
appHandle

out
out
out
out

pOpTrnDirState

Pointer to an operational train directory state structure to be returned.

pOpTrnDir

Pointer to an operational train directory structure to be returned.

pTrnDir

Pointer to a train directory structure to be returned.

pTrnNetDir

Pointer to a train network directory structure to be returned.

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

5.11.3.14

Handle returned by tlc_openSession().

no error
Parameter error

tau_getVehInfo()

EXT_DECL TRDP_ERR_T tau_getVehInfo (
TRDP_APP_SESSION_T appHandle,
TRDP_VEHICLE_INFO_T ∗ pVehInfo,
const TRDP_LABEL_T pVehLabel,
const TRDP_LABEL_T pCstLabel )

Function to retrieve the vehicle information of a consist's vehicle.

Generated by Doxygen

5.11 tau_tti.c File Reference
Parameters
in
appHandle

out
in
in

pVehInfo

Pointer to the vehicle info to be returned.

pVehLabel

Pointer to a vehicle label. NULL means own vehicle if cstLabel refers to own consist.

pCstLabel

Pointer to a consist label. NULL means own consist.

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

5.11.3.15

Handle returned by tlc_openSession().

no error
Parameter error

tau_getVehOrient()

EXT_DECL TRDP_ERR_T tau_getVehOrient (
TRDP_APP_SESSION_T appHandle,
UINT8 ∗ pVehOrient,
UINT8 ∗ pCstOrient,
TRDP_LABEL_T pVehLabel,
TRDP_LABEL_T pCstLabel )

Function to retrieve the orientation of the given vehicle.
Parameters
in
appHandle

Handle returned by tlc_openSession().

out

pVehOrient

Pointer to the vehicle orientation to be returned '00'B = not known (corrected vehicle)
'01'B = same as operational train direction '10'B = inverse to operational train direction

out

pCstOrient

Pointer to the consist orientation to be returned '00'B = not known (corrected vehicle)
'01'B = same as operational train direction '10'B = inverse to operational train direction

in
in

pVehLabel

vehLabel = NULL means own vehicle if cstLabel == NULL, currently ignored.

pCstLabel

cstLabel = NULL means own consist

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

5.11.3.16

no error
Parameter error

tau_initTTIaccess()

EXT_DECL TRDP_ERR_T tau_initTTIaccess (
TRDP_APP_SESSION_T appHandle,
VOS_SEMA_T userAction,
TRDP_IP_ADDR_T ecspIpAddr,
CHAR8 ∗ hostsFileName )
Generated by Doxygen

121

122

File Documentation

Function to init TTI access.
Subscribe to necessary process data for correct ECSP handling, further calls need DNS!

Generated by Doxygen

5.12 tau_tti.h File Reference
Parameters
in appHandle

in
in
in

userAction

Semaphore to fire if inauguration took place.

ecspIpAddr

ECSP IP address. Currently not used.

hostsFileName

Optional host file name as ECSP replacement. Currently not implemented.

Return values
TRDP_NO_ERR
TRDP_INIT_ERR

5.12

Handle returned by tlc_openSession().

no error
initialisation error

tau_tti.h File Reference

TRDP utility interface definitions.

#include "trdp_types.h"
#include "tau_tti_types.h"
Generated by Doxygen

123

124

File Documentation

Include dependency graph for tau_tti.h:

tau_tti.h

tau_tti_types.h

trdp_types.h

vos_mem.h

vos_thread.h

vos_sock.h

iec61375-2-3.h

vos_private.h

vos_types.h

stdint.h

Generated by Doxygen

5.12 tau_tti.h File Reference

125

This graph shows which files directly or indirectly include this file:

tau_tti.h

tau_ctrl_types.h

tau_cstinfo.c

tau_ctrl.h

tau_dnr.c

tau_tti.c

tau_ctrl.c

Functions
• EXT_DECL TRDP_ERR_T tau_initTTIaccess (TRDP_APP_SESSION_T appHandle, VOS_SEMA_T user←Action, TRDP_IP_ADDR_T ecspIpAddr, CHAR8 ∗hostsFileName)
Function to init TTI access.

• EXT_DECL void tau_deInitTTI (TRDP_APP_SESSION_T appHandle)
Function to terminate TTI access.

• EXT_DECL TRDP_ERR_T tau_getOpTrDirectory (TRDP_APP_SESSION_T appHandle, TRDP_OP_TRA←IN_DIR_STATE_T ∗pOpTrDirState, TRDP_OP_TRAIN_DIR_T ∗pOpTrDir)
Function to retrieve the operational train directory state.

• EXT_DECL TRDP_ERR_T tau_getOpTrnDirectoryStatusInfo (TRDP_APP_SESSION_T appHandle, TRD←P_OP_TRAIN_DIR_STATUS_INFO_T ∗pOpTrnDirStatusInfo)
Function to retrieve the operational train directory state info.

• EXT_DECL TRDP_ERR_T tau_getTrDirectory (TRDP_APP_SESSION_T appHandle, TRDP_TRAIN_DIR←_T ∗pTrDir)
Function to retrieve the operational train directory.

• EXT_DECL TRDP_ERR_T tau_getStaticCstInfo (TRDP_APP_SESSION_T appHandle, TRDP_CONSIST←_INFO_T ∗pCstInfo, TRDP_UUID_T const cstUUID)
Function to retrieve the operational train directory.

• EXT_DECL TRDP_ERR_T tau_getTTI (TRDP_APP_SESSION_T appHandle, TRDP_OP_TRAIN_DIR_S←TATE_T ∗pOpTrnDirState, TRDP_OP_TRAIN_DIR_T ∗pOpTrnDir, TRDP_TRAIN_DIR_T ∗pTrnDir, TRDP←_TRAIN_NET_DIR_T ∗pTrnNetDir)
Function to retrieve the operational train directory.

• EXT_DECL TRDP_ERR_T tau_getTrnCstCnt (TRDP_APP_SESSION_T appHandle, UINT16 ∗pTrnCstCnt)
Function to retrieve the total number of consists in the train.

• EXT_DECL TRDP_ERR_T tau_getTrnVehCnt (TRDP_APP_SESSION_T appHandle, UINT16 ∗pTrnVehCnt)
Function to retrieve the total number of vehicles in the train.

• EXT_DECL TRDP_ERR_T tau_getCstVehCnt (TRDP_APP_SESSION_T appHandle, UINT16 ∗pCstVehCnt,
const TRDP_LABEL_T pCstLabel)
Function to retrieve the total number of vehicles in a consist.
Generated by Doxygen

126

File Documentation
• EXT_DECL TRDP_ERR_T tau_getCstFctCnt (TRDP_APP_SESSION_T appHandle, UINT16 ∗pCstFctCnt,
const TRDP_LABEL_T pCstLabel)
Function to retrieve the total number of functions in a consist.

• EXT_DECL TRDP_ERR_T tau_getCstFctInfo (TRDP_APP_SESSION_T appHandle, TRDP_FUNCTION_←INFO_T ∗pFctInfo, const TRDP_LABEL_T pCstLabel, UINT16 maxFctCnt)
Function to retrieve the function information of the consist.

• EXT_DECL TRDP_ERR_T tau_getVehInfo (TRDP_APP_SESSION_T appHandle, TRDP_VEHICLE_INF←O_T ∗pVehInfo, const TRDP_LABEL_T pVehLabel, const TRDP_LABEL_T pCstLabel)
Function to retrieve the vehicle information of a consist's vehicle.

• EXT_DECL TRDP_ERR_T tau_getCstInfo (TRDP_APP_SESSION_T appHandle, TRDP_CONSIST_INF←O_T ∗pCstInfo, const TRDP_LABEL_T pCstLabel)
Function to retrieve the consist information of a train's consist.

• EXT_DECL TRDP_ERR_T tau_getVehOrient (TRDP_APP_SESSION_T appHandle, UINT8 ∗pVehOrient,
UINT8 ∗pCstOrient, TRDP_LABEL_T pVehLabel, TRDP_LABEL_T pCstLabel)
Function to retrieve the orientation of the given vehicle.

• EXT_DECL TRDP_ERR_T tau_getOwnIds (TRDP_APP_SESSION_T appHandle, TRDP_LABEL_T ∗p←DevId, TRDP_LABEL_T ∗pVehId, TRDP_LABEL_T ∗pCstId)
Who am I ?.

5.12.1

Detailed Description

TRDP utility interface definitions.
This module provides the interface to the following utilities
• train topology information access
Note
Project: TCNOpen TRDP prototype stack
Author
Armin-H. Weiss (initial version)
Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2014. All rights reserved.
Id
tau_tti.h 1755 2018-08-07 12:10:03Z bloehr
BL 2018-08-07: Ticket #183 tau_getOwnIds moved here
BL 2016-02-18: Ticket #7: Add train topology information support

5.12.2

Function Documentation

5.12.2.1

tau_deInitTTI()

EXT_DECL void tau_deInitTTI (
TRDP_APP_SESSION_T appHandle )

Function to terminate TTI access.

Generated by Doxygen

5.12 tau_tti.h File Reference
Parameters
in appHandle

Handle returned by tlc_openSession().

Return values
none Function to terminate TTI access.

Parameters
in appHandle

Handle returned by tlc_openSession().

Return values
none

5.12.2.2

tau_getCstFctCnt()

EXT_DECL TRDP_ERR_T tau_getCstFctCnt (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pCstFctCnt,
const TRDP_LABEL_T pCstLabel )

Function to retrieve the total number of functions in a consist.
Parameters
in
appHandle

out
in

Handle returned by tlc_openSession().

pCstFctCnt

Pointer to the number of functions to be returned

pCstLabel

Pointer to a consist label. NULL means own consist.

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

5.12.2.3

no error
Parameter error

tau_getCstFctInfo()

EXT_DECL TRDP_ERR_T tau_getCstFctInfo (
TRDP_APP_SESSION_T appHandle,
TRDP_FUNCTION_INFO_T ∗ pFctInfo,
const TRDP_LABEL_T pCstLabel,
UINT16 maxFctCnt )

Function to retrieve the function information of the consist.

Generated by Doxygen

127

128

File Documentation

Parameters
in
appHandle

Handle returned by tlc_openSession().

out

pFctInfo

in
in

pCstLabel

Pointer to function info list to be returned. Memory needs to be provided by application.
Set NULL if not used.
Pointer to a consist label. NULL means own consist.

maxFctCnt

Maximal number of functions to be returned in provided buffer.

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

5.12.2.4

Parameter error

tau_getCstInfo()

EXT_DECL TRDP_ERR_T tau_getCstInfo (
TRDP_APP_SESSION_T appHandle,
TRDP_CONSIST_INFO_T ∗ pCstInfo,
const TRDP_LABEL_T pCstLabel )

Function to retrieve the consist information of a train's consist.
Parameters
in
appHandle

out
in

Handle returned by tlc_openSession().

pCstInfo

Pointer to the consist info to be returned.

pCstLabel

Pointer to a consist label. NULL means own consist.

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

5.12.2.5

Parameter error

tau_getCstVehCnt()

EXT_DECL TRDP_ERR_T tau_getCstVehCnt (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pCstVehCnt,
const TRDP_LABEL_T pCstLabel )

Function to retrieve the total number of vehicles in a consist.
Parameters
in
appHandle

out
in

Handle returned by tlc_openSession().

pCstVehCnt

Pointer to the number of vehicles to be returned

pCstLabel

Pointer to a consist label. NULL means own consist.
Generated by Doxygen

5.12 tau_tti.h File Reference
Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

Parameters
in
appHandle

out
in

Parameter error

Handle returned by tlc_openSession().

pCstVehCnt

Pointer to the number of vehicles to be returned

pCstLabel

Pointer to a consist label. NULL means own consist.

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_NODATA_ERR

5.12.2.6

no error
Parameter error
Try again

tau_getOpTrDirectory()

EXT_DECL TRDP_ERR_T tau_getOpTrDirectory (
TRDP_APP_SESSION_T appHandle,
TRDP_OP_TRAIN_DIR_STATE_T ∗ pOpTrnDirState,
TRDP_OP_TRAIN_DIR_T ∗ pOpTrnDir )

Function to retrieve the operational train directory state.
Parameters
in
appHandle

out
out

pOpTrDirState

Pointer to an operational train directory state structure to be returned.

pOpTrDir

Pointer to an operational train directory structure to be returned.

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

Parameters
in
appHandle

out
out

Handle returned by tlc_openSession().

no error
Parameter error

Handle returned by tlc_openSession().

pOpTrnDirState

Pointer to an operational train directory state structure to be returned.

pOpTrnDir

Pointer to an operational train directory structure to be returned.

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_NODATA_ERR

Generated by Doxygen

no error
Parameter error
Data currently not available, try again later

129

130

5.12.2.7

File Documentation

tau_getOpTrnDirectoryStatusInfo()

EXT_DECL TRDP_ERR_T tau_getOpTrnDirectoryStatusInfo (
TRDP_APP_SESSION_T appHandle,
TRDP_OP_TRAIN_DIR_STATUS_INFO_T ∗ pOpTrnDirStatusInfo )

Function to retrieve the operational train directory state info.
Return a copy of the last received PD 100 telegram. Note: The values are in host endianess! When validating
(SDTv2), network endianess must be ensured.
Parameters
in
appHandle

out

Handle returned by tlc_openSession().

pOpTrnDirStatusInfo

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

5.12.2.8

Pointer to an operational train directory state structure to be returned.

Parameter error

tau_getOwnIds()

EXT_DECL TRDP_ERR_T tau_getOwnIds (
TRDP_APP_SESSION_T appHandle,
TRDP_LABEL_T ∗ pDevId,
TRDP_LABEL_T ∗ pVehId,
TRDP_LABEL_T ∗ pCstId )

Who am I ?.
Realizes a kind of 'Who am I' function. It is used to determine the own identifiers (i.e. the own labels), which may
be used as host part of the own fully qualified domain name.
Parameters
in
appHandle

out
out
out

Handle returned by tlc_openSession()

pDevId

Returns the device label (host name)

pVehId

Returns the vehicle label

pCstId

Returns the consist label

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_NODATA_ERR

no error
Parameter error
Data currently not available, call again

Generated by Doxygen

5.12 tau_tti.h File Reference

5.12.2.9

tau_getStaticCstInfo()

EXT_DECL TRDP_ERR_T tau_getStaticCstInfo (
TRDP_APP_SESSION_T appHandle,
TRDP_CONSIST_INFO_T ∗ pCstInfo,
TRDP_UUID_T const cstUUID )

Function to retrieve the operational train directory.
Parameters
in
appHandle

out
in

Handle returned by tlc_openSession().

pCstInfo

Pointer to a consist info structure to be returned.

cstUUID

UUID of the consist the consist info is rquested for.

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

no error
Parameter error

Function to retrieve the operational train directory.
Parameters
in
appHandle

out
in

pCstInfo

Pointer to a consist info structure to be returned.

cstUUID

UUID of the consist the consist info is rquested for.

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

5.12.2.10

Handle returned by tlc_openSession().

no error
Parameter error

tau_getTrDirectory()

EXT_DECL TRDP_ERR_T tau_getTrDirectory (
TRDP_APP_SESSION_T appHandle,
TRDP_TRAIN_DIR_T ∗ pTrnDir )

Function to retrieve the operational train directory.
Parameters
in
appHandle

out

pTrDir

Generated by Doxygen

Handle returned by tlc_openSession().
Pointer to a train directory structure to be returned.

131

132

File Documentation

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

Parameter error

Function to retrieve the operational train directory.
Parameters
in
appHandle

out

pTrnDir

Handle returned by tlc_openSession().
Pointer to a train directory structure to be returned.

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

Parameter error

TRDP_NODATA_ERR

5.12.2.11

Try later

tau_getTrnCstCnt()

EXT_DECL TRDP_ERR_T tau_getTrnCstCnt (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pTrnCstCnt )

Function to retrieve the total number of consists in the train.
Parameters
in
appHandle

out

pTrnCstCnt

Handle returned by tlc_openSession().
Pointer to the number of consists to be returned

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

Parameters
in
appHandle

out

pTrnCstCnt

Parameter error

Handle returned by tlc_openSession().
Pointer to the number of consists to be returned

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_NODATA_ERR

no error
Parameter error
Try again

Generated by Doxygen

5.12 tau_tti.h File Reference

5.12.2.12

tau_getTrnVehCnt()

EXT_DECL TRDP_ERR_T tau_getTrnVehCnt (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pTrnVehCnt )

Function to retrieve the total number of vehicles in the train.
Parameters
in
appHandle

out

pTrnVehCnt

Handle returned by tlc_openSession().
Pointer to the number of vehicles to be returned

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

Parameters
in
appHandle

out

pTrnVehCnt

Parameter error

Handle returned by tlc_openSession().
Pointer to the number of vehicles to be returned

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_NODATA_ERR

5.12.2.13

no error
Parameter error
Try again

tau_getTTI()

EXT_DECL TRDP_ERR_T tau_getTTI (
TRDP_APP_SESSION_T appHandle,
TRDP_OP_TRAIN_DIR_STATE_T ∗ pOpTrnDirState,
TRDP_OP_TRAIN_DIR_T ∗ pOpTrnDir,
TRDP_TRAIN_DIR_T ∗ pTrnDir,
TRDP_TRAIN_NET_DIR_T ∗ pTrnNetDir )

Function to retrieve the operational train directory.
Parameters
in
appHandle

out
out
out
out

Handle returned by tlc_openSession().

pOpTrnDirState

Pointer to an operational train directory state structure to be returned.

pOpTrnDir

Pointer to an operational train directory structure to be returned.

pTrnDir

Pointer to a train directory structure to be returned.

pTrnNetDir

Pointer to a train network directory structure to be returned.

Generated by Doxygen

133

134

File Documentation

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

5.12.2.14

Parameter error

tau_getVehInfo()

EXT_DECL TRDP_ERR_T tau_getVehInfo (
TRDP_APP_SESSION_T appHandle,
TRDP_VEHICLE_INFO_T ∗ pVehInfo,
const TRDP_LABEL_T pVehLabel,
const TRDP_LABEL_T pCstLabel )

Function to retrieve the vehicle information of a consist's vehicle.
Parameters
in
appHandle

out
in
in

Pointer to the vehicle info to be returned.

pVehLabel

Pointer to a vehicle label. NULL means own vehicle if cstLabel refers to own consist.

pCstLabel

Pointer to a consist label. NULL means own consist.

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

5.12.2.15

Handle returned by tlc_openSession().

pVehInfo

no error
Parameter error

tau_getVehOrient()

EXT_DECL TRDP_ERR_T tau_getVehOrient (
TRDP_APP_SESSION_T appHandle,
UINT8 ∗ pVehOrient,
UINT8 ∗ pCstOrient,
TRDP_LABEL_T pVehLabel,
TRDP_LABEL_T pCstLabel )

Function to retrieve the orientation of the given vehicle.
Parameters
in
appHandle

Handle returned by tlc_openSession().

out

pVehOrient

Pointer to the vehicle orientation to be returned '00'B = not known (corrected vehicle)
'01'B = same as operational train direction '10'B = inverse to operational train direction

out

pCstOrient

Pointer to the consist orientation to be returned '00'B = not known (corrected vehicle)
'01'B = same as operational train direction '10'B = inverse to operational train direction

in
in

pVehLabel

vehLabel = NULL means own vehicle if cstLabel == NULL

pCstLabel

cstLabel = NULL means own consist
Generated by Doxygen

5.12 tau_tti.h File Reference
Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

Parameters
in
appHandle

no error
Parameter error

Handle returned by tlc_openSession().

out

pVehOrient

Pointer to the vehicle orientation to be returned '00'B = not known (corrected vehicle)
'01'B = same as operational train direction '10'B = inverse to operational train direction

out

pCstOrient

Pointer to the consist orientation to be returned '00'B = not known (corrected vehicle)
'01'B = same as operational train direction '10'B = inverse to operational train direction

in
in

pVehLabel

vehLabel = NULL means own vehicle if cstLabel == NULL, currently ignored.

pCstLabel

cstLabel = NULL means own consist

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

5.12.2.16

no error
Parameter error

tau_initTTIaccess()

EXT_DECL TRDP_ERR_T tau_initTTIaccess (
TRDP_APP_SESSION_T appHandle,
VOS_SEMA_T userAction,
TRDP_IP_ADDR_T ecspIpAddr,
CHAR8 ∗ hostsFileName )

Function to init TTI access.
Parameters
in appHandle

in
in
in

Handle returned by tlc_openSession().

userAction

Semaphore to fire if inauguration took place.

ecspIpAddr

ECSP IP address.

hostsFileName

Optional host file name as ECSP replacement.

Return values
TRDP_NO_ERR
TRDP_INIT_ERR

no error
initialisation error

Subscribe to necessary process data for correct ECSP handling, further calls need DNS!
Parameters
in appHandle

in
in

Handle returned by tlc_openSession().

userAction

Semaphore to fire if inauguration took place.

ecspIpAddr

ECSP IP address. Currently not used.

Generated by Doxygen

135

136

File Documentation

Parameters
in hostsFileName

Return values
TRDP_NO_ERR
TRDP_INIT_ERR

5.13

Optional host file name as ECSP replacement. Currently not implemented.

no error
initialisation error

tau_tti_types.h File Reference

TRDP utility interface definitions.

#include "trdp_types.h"
Include dependency graph for tau_tti_types.h:

tau_tti_types.h

trdp_types.h

vos_mem.h

vos_thread.h

vos_sock.h

iec61375-2-3.h

vos_private.h

vos_types.h

stdint.h

Generated by Doxygen

5.13 tau_tti_types.h File Reference

137

This graph shows which files directly or indirectly include this file:

tau_tti_types.h

tau_tti.h

tau_ctrl_types.h

tau_ctrl.h

tau_ctrl.c

Data Structures
• struct GNU_PACKED
Types for ETB control.

• struct TRDP_ETB_INFO_T
Types for train configuration information.

• struct TRDP_CLTR_CST_INFO_T
Closed train consists information.

• struct TRDP_PROP_T
Application defined properties.

• struct TRDP_FUNCTION_INFO_T
function/device information structure

• struct TRDP_VEHICLE_INFO_T
vehicle information structure

• struct TRDP_CONSIST_INFO_T
consist information structure

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Generated by Doxygen

tau_cstinfo.c

tau_tti.c

tau_dnr.c

138

File Documentation

Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

Macros
• #define TRDP_MAX_CST_CNT 63u
max number of consists per train

• #define TRDP_MAX_VEH_CNT 63u
max number of vehicles per train

5.13.1

Detailed Description

TRDP utility interface definitions.
This module provides the interface to the following utilities
• train topology information access type definitions acc. to IEC61375-2-3

Note
Project: TCNOpen TRDP prototype stack

Author
Armin-H. Weiss (initial version)

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2014. All rights reserved.
Id
tau_tti_types.h 1763 2018-09-21 16:03:13Z ahweiss
BL 2017-11-13: Ticket #176 TRDP_LABEL_T breaks field alignment -> TRDP_NET_LABEL_T
BL 2017-05-08: Compiler warnings, doxygen comment errors
Generated by Doxygen

5.14 tau_xml.c File Reference

5.14

139

tau_xml.c File Reference

Functions for XML file parsing.

#include
#include
#include
#include
#include
#include
#include




"trdp_types.h"
"trdp_utils.h"
"tau_xml.h"
"trdp_xml.h"

Include dependency graph for tau_xml.c:

tau_xml.c

string.h

stdio.h

trdp_xml.h

trdp_utils.h

vos_utils.h

trdp_private.h

stdlib.h

tau_xml.h

stddef.h

trdp_types.h

vos_sock.h

vos_thread.h

vos_mem.h

iec61375-2-3.h

vos_private.h

vos_types.h

stdint.h

Macros
• #define TRDP_SDT_DEFAULT_SMI2 0u
Default SDT safe message identifier.

• #define TRDP_SDT_DEFAULT_NRXSAFE 3u
Default SDT timeout cycles.

• #define TRDP_SDT_DEFAULT_NGUARD 100u
Default SDT initial timeout cycles.

• #define TRDP_SDT_DEFAULT_CMTHR 10u
Default SDT chan.

Functions
• EXT_DECL TRDP_ERR_T tau_prepareXmlDoc (const CHAR8 ∗pFileName, TRDP_XML_DOC_HANDLE←_T ∗pDocHnd)
Open XML file, prepare XPath context.

• EXT_DECL void tau_freeXmlDoc (TRDP_XML_DOC_HANDLE_T ∗pDocHnd)
Free all the memory allocated by tau_prepareXmlDoc.

Generated by Doxygen

140

File Documentation
• EXT_DECL TRDP_ERR_T tau_readXmlInterfaceConfig (const TRDP_XML_DOC_HANDLE_T ∗pDocHnd,
const CHAR8 ∗pIfName, TRDP_PROCESS_CONFIG_T ∗pProcessConfig, TRDP_PD_CONFIG_T ∗p←PdConfig, TRDP_MD_CONFIG_T ∗pMdConfig, UINT32 ∗pNumExchgPar, TRDP_EXCHG_PAR_T ∗∗pp←ExchgPar)
Read the interface relevant telegram parameters (except data set configuration) out of the configuration file .

• EXT_DECL void tau_freeTelegrams (UINT32 numExchgPar, TRDP_EXCHG_PAR_T ∗pExchgPar)
Free array of telegram configurations allocated by tau_readXmlInterfaceConfig.

• EXT_DECL TRDP_ERR_T tau_readXmlDeviceConfig (const TRDP_XML_DOC_HANDLE_T ∗pDocHnd,
TRDP_MEM_CONFIG_T ∗pMemConfig, TRDP_DBG_CONFIG_T ∗pDbgConfig, UINT32 ∗pNumComPar,
TRDP_COM_PAR_T ∗∗ppComPar, UINT32 ∗pNumIfConfig, TRDP_IF_CONFIG_T ∗∗ppIfConfig)
Function to read the TRDP device configuration parameters out of the XML configuration file.

• EXT_DECL TRDP_ERR_T tau_readXmlDatasetConfig (const TRDP_XML_DOC_HANDLE_T ∗pDocHnd,
UINT32 ∗pNumComId, TRDP_COMID_DSID_MAP_T ∗∗ppComIdDsIdMap, UINT32 ∗pNumDataset, ap←TRDP_DATASET_T ∗apDataset)
Function to read the DataSet configuration out of the XML configuration file.

• EXT_DECL void tau_freeXmlDatasetConfig (UINT32 numComId, TRDP_COMID_DSID_MAP_T ∗pComId←DsIdMap, UINT32 numDataset, TRDP_DATASET_T ∗∗ppDataset)
Function to free the memory for the DataSet configuration.

5.14.1

Detailed Description

Functions for XML file parsing.
SOX parsing of XML configuration file
Note
Project: TCNOpen TRDP prototype stack

Author
B. Loehr, NewTec GmbH, Tomas Svoboda, UniControls a.s.

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
NewTec GmbH, 2016. All rights reserved.
Id
tau_xml.c 1770 2018-10-29 10:49:08Z s-bender
SB
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL

2018-10-29:
2018-10-01:
2018-09-05:
2018-05-03:
2018-01-30:
2017-06-08:
2017-05-08:
2017-03-01:
2017-02-27:
2016-07-06:
2016-03-21:
2016-03-04:
2016-02-11:
2016-02-11:
2016-01-25:

Ticket #214 Incorrect parsing of  and  elements
Some default attribute values for com-parameter tag were missing
Ticket #211 XML handling: Dataset Name should be stored in TRDP_DATASET_ELEMENT_T
Ticket #194: Platform independent format specifiers in vos_printLog
Ticket #189 timeout-value not parsed in tau_xml
Compiler warning (unused dbgPrint)
Compiler warnings (static definitions)
Ticket #149 SourceUri and DestinationUri don’t with 32 characters
Ticket #142 Compiler warnings / MISRA-C 2012 issues
Ticket #122 64Bit compatibility (+ compiler warnings)
Ticket #116: Memory corruption using new XML library
Ticket #113: parsing of dataset element "type" always returns 0
Ticket #111: unit, scale, offset added
Ticket #102: Replacing libxml2
Ticket #106: Callback can be ON, OFF, ALWAYS
Generated by Doxygen

5.14 tau_xml.c File Reference

5.14.2

Macro Definition Documentation

5.14.2.1

TRDP_SDT_DEFAULT_CMTHR

#define TRDP_SDT_DEFAULT_CMTHR 10u

Default SDT chan.
monitoring threshold

5.14.3

Function Documentation

5.14.3.1

tau_freeTelegrams()

EXT_DECL void tau_freeTelegrams (
UINT32 numExchgPar,
TRDP_EXCHG_PAR_T ∗ pExchgPar )

Free array of telegram configurations allocated by tau_readXmlInterfaceConfig.
Parameters
in numExchgPar

in

5.14.3.2

pExchgPar

Number of telegram configurations in the array
Pointer to array of telegram configurations

tau_freeXmlDatasetConfig()

EXT_DECL void tau_freeXmlDatasetConfig (
UINT32 numComId,
TRDP_COMID_DSID_MAP_T ∗ pComIdDsIdMap,
UINT32 numDataset,
TRDP_DATASET_T ∗∗ ppDataset )

Function to free the memory for the DataSet configuration.
Free the memory for the DataSet configuration which was allocated when parsing the XML configuration file.
Parameters
in numComId

in
in
in

The number of entries in the ComId DatasetId mapping list

pComIdDsIdMap

Pointer to an array of structures of type TRDP_COMID_DSID_MAP_T

numDataset

The number of datasets found in the configuration

ppDataset

Pointer to an array of pointers to a structures of type TRDP_DATASET_T

Generated by Doxygen

141

142

File Documentation

Return values
none

5.14.3.3

tau_freeXmlDoc()

EXT_DECL void tau_freeXmlDoc (
TRDP_XML_DOC_HANDLE_T ∗ pDocHnd )

Free all the memory allocated by tau_prepareXmlDoc.
Parameters
in pDocHnd

5.14.3.4

Handle of the parsed XML file

tau_prepareXmlDoc()

EXT_DECL TRDP_ERR_T tau_prepareXmlDoc (
const CHAR8 ∗ pFileName,
TRDP_XML_DOC_HANDLE_T ∗ pDocHnd )

Open XML file, prepare XPath context.
Load XML file into DOM tree, prepare XPath context.
Parameters
in
pFileName

out

pDocHnd

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

5.14.3.5

Path and filename of the xml configuration file
Handle of the parsed XML file

no error
File does not exist

tau_readXmlDatasetConfig()

EXT_DECL TRDP_ERR_T tau_readXmlDatasetConfig (
const TRDP_XML_DOC_HANDLE_T ∗ pDocHnd,
UINT32 ∗ pNumComId,
TRDP_COMID_DSID_MAP_T ∗∗ ppComIdDsIdMap,
UINT32 ∗ pNumDataset,
apTRDP_DATASET_T ∗ apDataset )
Generated by Doxygen

5.14 tau_xml.c File Reference

Function to read the DataSet configuration out of the XML configuration file.

Generated by Doxygen

143

144

File Documentation

Parameters
in
pDocHnd

out
out
out
out

pNumComId

Pointer to the number of entries in the ComId DatasetId mapping list

ppComIdDsIdMap

Pointer to an array of a structures of type TRDP_COMID_DSID_MAP_T

pNumDataset

Pointer to the number of datasets found in the configuration

apDataset

Pointer to an array of pointers to a structure of type TRDP_DATASET_T

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

5.14.3.6

Handle of the XML document prepared by tau_prepareXmlDoc

no error
provided buffer to small
File not existing

tau_readXmlDeviceConfig()

EXT_DECL TRDP_ERR_T tau_readXmlDeviceConfig (
const TRDP_XML_DOC_HANDLE_T ∗ pDocHnd,
TRDP_MEM_CONFIG_T ∗ pMemConfig,
TRDP_DBG_CONFIG_T ∗ pDbgConfig,
UINT32 ∗ pNumComPar,
TRDP_COM_PAR_T ∗∗ ppComPar,
UINT32 ∗ pNumIfConfig,
TRDP_IF_CONFIG_T ∗∗ ppIfConfig )

Function to read the TRDP device configuration parameters out of the XML configuration file.
The user must release the memory for ppComPar and ppIfConfig (using vos_memFree)
Parameters
in
pDocHnd

out
out
out
out
out
out

Handle of the XML document prepared by tau_prepareXmlDoc

pMemConfig

Memory configuration

pDbgConfig

Debug printout configuration for application use

pNumComPar

Number of configured com parameters

ppComPar

Pointer to array of com parameters

pNumIfConfig

Number of configured interfaces

ppIfConfig

Pointer to an array of interface parameter sets

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

no error
provided buffer to small
File not existing

Generated by Doxygen

5.15 tau_xml.h File Reference

5.14.3.7

tau_readXmlInterfaceConfig()

EXT_DECL TRDP_ERR_T tau_readXmlInterfaceConfig (
const TRDP_XML_DOC_HANDLE_T ∗ pDocHnd,
const CHAR8 ∗ pIfName,
TRDP_PROCESS_CONFIG_T ∗ pProcessConfig,
TRDP_PD_CONFIG_T ∗ pPdConfig,
TRDP_MD_CONFIG_T ∗ pMdConfig,
UINT32 ∗ pNumExchgPar,
TRDP_EXCHG_PAR_T ∗∗ ppExchgPar )

Read the interface relevant telegram parameters (except data set configuration) out of the configuration file .
Parameters
in
pDocHnd

in
out
out
out
out
out

pIfName

Interface name

pProcessConfig

TRDP process (session) configuration for the interface

pPdConfig

PD default configuration for the interface

pMdConfig

MD default configuration for the interface

pNumExchgPar

Number of configured telegrams

ppExchgPar

Pointer to array of telegram configurations

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

5.15

Handle of the XML document prepared by tau_prepareXmlDoc

no error
provided buffer to small
File not existing

tau_xml.h File Reference

TRDP utility interface definitions.

#include "vos_types.h"
#include "trdp_types.h"
Generated by Doxygen

145

146

File Documentation

Include dependency graph for tau_xml.h:

tau_xml.h

trdp_types.h

vos_mem.h

vos_sock.h

vos_thread.h

iec61375-2-3.h

vos_private.h

vos_types.h

stdint.h

This graph shows which files directly or indirectly include this file:

tau_xml.h

tau_xml.c

Data Structures
• struct TRDP_SDT_PAR_T
Types to read out the XML configuration.

• struct TRDP_DBG_CONFIG_T
Control for debug output device/file on application level.

• struct TRDP_XML_DOC_HANDLE_T
Parsed XML document handle.
Generated by Doxygen

5.15 tau_xml.h File Reference

147

Macros
• #define TRDP_DBG_DEFAULT 0,
Control for debug output format on application level.

• #define TRDP_DBG_OFF 0x01
Printout off.

• #define TRDP_DBG_ERR 0x02
Printout error.

• #define TRDP_DBG_WARN 0x04
Printout warning and error.

• #define TRDP_DBG_INFO 0x08
Printout info, warning and error.

• #define TRDP_DBG_DBG 0x10
Printout debug, info, warning and error.

• #define TRDP_DBG_TIME 0x20
Printout timestamp.

• #define TRDP_DBG_LOC 0x40
Printout file name and line.

• #define TRDP_DBG_CAT 0x80
Printout category (DBG, INFO, WARN, ERR)

Enumerations
• enum TRDP_EXCHG_OPTION_T {
TRDP_EXCHG_UNSET = 0,
TRDP_EXCHG_SOURCE = 1,
TRDP_EXCHG_SINK = 2,
TRDP_EXCHG_SOURCESINK = 3 }
Type attribute for telegrams.

Functions
• EXT_DECL TRDP_ERR_T tau_prepareXmlDoc (const CHAR8 ∗pFileName, TRDP_XML_DOC_HANDLE←_T ∗pDocHnd)
Load XML file into DOM tree, prepare XPath context.

• EXT_DECL void tau_freeXmlDoc (TRDP_XML_DOC_HANDLE_T ∗pDocHnd)
Free all the memory allocated by tau_prepareXmlDoc.

• EXT_DECL TRDP_ERR_T tau_readXmlDeviceConfig (const TRDP_XML_DOC_HANDLE_T ∗pDocHnd,
TRDP_MEM_CONFIG_T ∗pMemConfig, TRDP_DBG_CONFIG_T ∗pDbgConfig, UINT32 ∗pNumComPar,
TRDP_COM_PAR_T ∗∗ppComPar, UINT32 ∗pNumIfConfig, TRDP_IF_CONFIG_T ∗∗ppIfConfig)
Function to read the TRDP device configuration parameters out of the XML configuration file.

• EXT_DECL TRDP_ERR_T tau_readXmlInterfaceConfig (const TRDP_XML_DOC_HANDLE_T ∗pDocHnd,
const CHAR8 ∗pIfName, TRDP_PROCESS_CONFIG_T ∗pProcessConfig, TRDP_PD_CONFIG_T ∗p←PdConfig, TRDP_MD_CONFIG_T ∗pMdConfig, UINT32 ∗pNumExchgPar, TRDP_EXCHG_PAR_T ∗∗pp←ExchgPar)
Read the interface relevant telegram parameters (except data set configuration) out of the configuration file .

• EXT_DECL TRDP_ERR_T tau_readXmlDatasetConfig (const TRDP_XML_DOC_HANDLE_T ∗pDocHnd,
UINT32 ∗pNumComId, TRDP_COMID_DSID_MAP_T ∗∗ppComIdDsIdMap, UINT32 ∗pNumDataset, pap←TRDP_DATASET_T papDataset)
Function to read the DataSet configuration out of the XML configuration file.

• EXT_DECL void tau_freeXmlDatasetConfig (UINT32 numComId, TRDP_COMID_DSID_MAP_T ∗pComId←DsIdMap, UINT32 numDataset, TRDP_DATASET_T ∗∗pNumDataset)
Function to free the memory for the DataSet configuration.

• EXT_DECL void tau_freeTelegrams (UINT32 numExchgPar, TRDP_EXCHG_PAR_T ∗pExchgPar)
Free array of telegram configurations allocated by tau_readXmlInterfaceConfig.
Generated by Doxygen

148

File Documentation

5.15.1

Detailed Description

TRDP utility interface definitions.
This module provides the interface to the following utilities
• read xml configuration interpreter

Note
Project: TCNOpen TRDP prototype stack

Author
Armin-H. Weiss (initial version)

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.
Id
tau_xml.h 1601 2017-05-08 15:27:38Z bloehr
BL 2017-05-08: Compiler warnings, flag enums -> defines
BL 2016-02-11: Ticket #102: Custom XML parser, libxml2 not needed anymore

5.15.2

Macro Definition Documentation

5.15.2.1

TRDP_DBG_DEFAULT

#define TRDP_DBG_DEFAULT 0,

Control for debug output format on application level.
Printout default

5.15.3

Enumeration Type Documentation

5.15.3.1

TRDP_EXCHG_OPTION_T

enum TRDP_EXCHG_OPTION_T

Type attribute for telegrams.

Generated by Doxygen

5.15 tau_xml.h File Reference
Enumerator
TRDP_EXCHG_UNSET
TRDP_EXCHG_SOURCE
TRDP_EXCHG_SINK
TRDP_EXCHG_SOURCESINK

5.15.4

Function Documentation

5.15.4.1

tau_freeTelegrams()

149

default, direction is not defined
telegram shall be published
telegram shall be subscribed
telegram shall be published and subscribed

EXT_DECL void tau_freeTelegrams (
UINT32 numExchgPar,
TRDP_EXCHG_PAR_T ∗ pExchgPar )

Free array of telegram configurations allocated by tau_readXmlInterfaceConfig.
Parameters
in numExchgPar

in

5.15.4.2

pExchgPar

Number of telegram configurations in the array
Pointer to array of telegram configurations

tau_freeXmlDatasetConfig()

EXT_DECL void tau_freeXmlDatasetConfig (
UINT32 numComId,
TRDP_COMID_DSID_MAP_T ∗ pComIdDsIdMap,
UINT32 numDataset,
TRDP_DATASET_T ∗∗ ppDataset )

Function to free the memory for the DataSet configuration.
Free the memory for the DataSet configuration which was allocated when parsing the XML configuration file.
Parameters
in numComId

in
in
in

The number of entries in the ComId DatasetId mapping list

pComIdDsIdMap

Pointer to an array of structures of type TRDP_COMID_DSID_MAP_T

numDataset

The number of datasets found in the configuration

pNumDataset

Pointer to an array of pointers to a structures of type TRDP_DATASET_T

Return values
none Free the memory for the DataSet configuration which was allocated when parsing the XML
configuration file.
Generated by Doxygen

150

File Documentation

Parameters
in numComId

in
in
in

The number of entries in the ComId DatasetId mapping list

pComIdDsIdMap

Pointer to an array of structures of type TRDP_COMID_DSID_MAP_T

numDataset

The number of datasets found in the configuration

ppDataset

Pointer to an array of pointers to a structures of type TRDP_DATASET_T

Return values
none

5.15.4.3

tau_freeXmlDoc()

EXT_DECL void tau_freeXmlDoc (
TRDP_XML_DOC_HANDLE_T ∗ pDocHnd )

Free all the memory allocated by tau_prepareXmlDoc.
Parameters
in pDocHnd

5.15.4.4

Handle of the parsed XML file

tau_prepareXmlDoc()

EXT_DECL TRDP_ERR_T tau_prepareXmlDoc (
const CHAR8 ∗ pFileName,
TRDP_XML_DOC_HANDLE_T ∗ pDocHnd )

Load XML file into DOM tree, prepare XPath context.
Parameters
in
pFileName

out

pDocHnd

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

Path and filename of the xml configuration file
Handle of the parsed XML file

no error
File does not exist

Load XML file into DOM tree, prepare XPath context.
Parameters
in
pFileName

out

pDocHnd

Path and filename of the xml configuration file
Handle of the parsed XML file
Generated by Doxygen

5.15 tau_xml.h File Reference
Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

5.15.4.5

no error
File does not exist

tau_readXmlDatasetConfig()

EXT_DECL TRDP_ERR_T tau_readXmlDatasetConfig (
const TRDP_XML_DOC_HANDLE_T ∗ pDocHnd,
UINT32 ∗ pNumComId,
TRDP_COMID_DSID_MAP_T ∗∗ ppComIdDsIdMap,
UINT32 ∗ pNumDataset,
papTRDP_DATASET_T papDataset )

Function to read the DataSet configuration out of the XML configuration file.
Parameters
in
pDocHnd

out
out
out
out

pNumComId

Pointer to the number of entries in the ComId DatasetId mapping list

ppComIdDsIdMap

Pointer to an array of a structures of type TRDP_COMID_DSID_MAP_T

pNumDataset

Pointer to the number of datasets found in the configuration

papDataset

Pointer to an array of pointers to a structures of type TRDP_DATASET_T

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

5.15.4.6

Handle of the XML document prepared by tau_prepareXmlDoc

no error
provided buffer to small
File not existing

tau_readXmlDeviceConfig()

EXT_DECL TRDP_ERR_T tau_readXmlDeviceConfig (
const TRDP_XML_DOC_HANDLE_T ∗ pDocHnd,
TRDP_MEM_CONFIG_T ∗ pMemConfig,
TRDP_DBG_CONFIG_T ∗ pDbgConfig,
UINT32 ∗ pNumComPar,
TRDP_COM_PAR_T ∗∗ ppComPar,
UINT32 ∗ pNumIfConfig,
TRDP_IF_CONFIG_T ∗∗ ppIfConfig )

Function to read the TRDP device configuration parameters out of the XML configuration file.
Parameters
in
pDocHnd

out

pMemConfig

Generated by Doxygen

Handle of the XML document prepared by tau_prepareXmlDoc
Memory configuration

151

152

File Documentation

Parameters
out pDbgConfig

out
out
out
out

Debug printout configuration for application use

pNumComPar

Number of configured com parameters

ppComPar

Pointer to array of com parameters

pNumIfConfig

Number of configured interfaces

ppIfConfig

Pointer to an array of interface parameter sets

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

no error
provided buffer to small
File not existing

The user must release the memory for ppComPar and ppIfConfig (using vos_memFree)
Parameters
in
pDocHnd

out
out
out
out
out
out

pMemConfig

Memory configuration

pDbgConfig

Debug printout configuration for application use

pNumComPar

Number of configured com parameters

ppComPar

Pointer to array of com parameters

pNumIfConfig

Number of configured interfaces

ppIfConfig

Pointer to an array of interface parameter sets

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

5.15.4.7

Handle of the XML document prepared by tau_prepareXmlDoc

no error
provided buffer to small
File not existing

tau_readXmlInterfaceConfig()

EXT_DECL TRDP_ERR_T tau_readXmlInterfaceConfig (
const TRDP_XML_DOC_HANDLE_T ∗ pDocHnd,
const CHAR8 ∗ pIfName,
TRDP_PROCESS_CONFIG_T ∗ pProcessConfig,
TRDP_PD_CONFIG_T ∗ pPdConfig,
TRDP_MD_CONFIG_T ∗ pMdConfig,
UINT32 ∗ pNumExchgPar,
TRDP_EXCHG_PAR_T ∗∗ ppExchgPar )

Read the interface relevant telegram parameters (except data set configuration) out of the configuration file .
Parameters
in
pDocHnd

Handle of the XML document prepared by tau_prepareXmlDoc

Generated by Doxygen

5.16 trdp_dllmain.c File Reference
Parameters
in
pIfName

out
out
out
out
out

TRDP process (session) configuration for the interface

pPdConfig

PD default configuration for the interface

pMdConfig

MD default configuration for the interface

pNumExchgPar

Number of configured telegrams

ppExchgPar

Pointer to array of telegram configurations

TRDP_MEM_ERR
TRDP_PARAM_ERR

5.16

Interface name

pProcessConfig

Return values
TRDP_NO_ERR

153

no error
provided buffer to small
File not existing

trdp_dllmain.c File Reference

Windows DLL main function.

5.16.1

Detailed Description

Windows DLL main function.

Note
Project: TCNOpen TRDP prototype stack

Author
Armin-H. Weiss, Bombardier

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.

Id
trdp_dllmain.c 1763 2018-09-21 16:03:13Z ahweiss
Generated by Doxygen

154

File Documentation

5.17

trdp_if.c File Reference

Functions for ECN communication.

#include
#include
#include
#include
#include
#include
#include
#include


"trdp_if_light.h"
"trdp_utils.h"
"trdp_pdcom.h"
"trdp_stats.h"
"vos_sock.h"
"vos_mem.h"
"vos_utils.h"

Include dependency graph for trdp_if.c:

trdp_if.c

string.h

trdp_pdcom.h

trdp_if_light.h

trdp_stats.h

trdp_private.h

trdp_types.h

vos_mem.h

trdp_utils.h

vos_utils.h

stddef.h

iec61375-2-3.h

stdio.h

vos_sock.h

vos_thread.h

vos_private.h

vos_types.h

stdint.h

Functions
• BOOL8 trdp_isValidSession (TRDP_APP_SESSION_T pSessionHandle)
Check if the session handle is valid.

• TRDP_APP_SESSION_T ∗ trdp_sessionQueue (void)
Get the session queue head pointer.

• EXT_DECL TRDP_IP_ADDR_T tlc_getOwnIpAddress (TRDP_APP_SESSION_T appHandle)
Get the interface address.

• EXT_DECL TRDP_ERR_T tlc_init (const TRDP_PRINT_DBG_T pPrintDebugString, void ∗pRefCon, const
TRDP_MEM_CONFIG_T ∗pMemConfig)
Initialize the TRDP stack.
Generated by Doxygen

5.17 trdp_if.c File Reference

155

• EXT_DECL TRDP_ERR_T tlc_openSession (TRDP_APP_SESSION_T ∗pAppHandle, TRDP_IP_ADDR←_T ownIpAddr, TRDP_IP_ADDR_T leaderIpAddr, const TRDP_MARSHALL_CONFIG_T ∗pMarshall, const
TRDP_PD_CONFIG_T ∗pPdDefault, const TRDP_MD_CONFIG_T ∗pMdDefault, const TRDP_PROCES←S_CONFIG_T ∗pProcessConfig)
Open a session with the TRDP stack.

• EXT_DECL TRDP_ERR_T tlc_configSession (TRDP_APP_SESSION_T appHandle, const TRDP_MAR←SHALL_CONFIG_T ∗pMarshall, const TRDP_PD_CONFIG_T ∗pPdDefault, const TRDP_MD_CONFIG_T
∗pMdDefault, const TRDP_PROCESS_CONFIG_T ∗pProcessConfig)
(Re-)configure a session.

• EXT_DECL TRDP_ERR_T tlc_closeSession (TRDP_APP_SESSION_T appHandle)
Close a session.

• EXT_DECL TRDP_ERR_T tlc_terminate (void)
Un-Initialize.

• EXT_DECL TRDP_ERR_T tlc_reinitSession (TRDP_APP_SESSION_T appHandle)
Re-Initialize.

• const char ∗ tlc_getVersionString (void)
Return a human readable version representation.

• EXT_DECL const TRDP_VERSION_T ∗ tlc_getVersion (void)
Return version.

• TRDP_ERR_T tlp_setRedundant (TRDP_APP_SESSION_T appHandle, UINT32 redId, BOOL8 leader)
Do not send non-redundant PDs when we are follower.

• EXT_DECL TRDP_ERR_T tlp_getRedundant (TRDP_APP_SESSION_T appHandle, UINT32 redId, BOOL8
∗pLeader)
Get status of redundant ComIds.

• EXT_DECL TRDP_ERR_T tlc_setETBTopoCount (TRDP_APP_SESSION_T appHandle, UINT32 etbTopo←Cnt)
Set new topocount for trainwide communication.

• EXT_DECL TRDP_ERR_T tlc_setOpTrainTopoCount (TRDP_APP_SESSION_T appHandle, UINT32 op←TrnTopoCnt)
Set new operational train topocount for direction/orientation sensitive communication.

• EXT_DECL UINT32 tlc_getETBTopoCount (TRDP_APP_SESSION_T appHandle)
Set new topocount for trainwide communication.

• EXT_DECL UINT32 tlc_getOpTrainTopoCount (TRDP_APP_SESSION_T appHandle)
Set new operational train topocount for direction/orientation sensitive communication.

• EXT_DECL TRDP_ERR_T tlp_publish (TRDP_APP_SESSION_T appHandle, TRDP_PUB_T ∗pPubHandle,
const void ∗pUserRef, TRDP_PD_CALLBACK_T pfCbFunction, UINT32 comId, UINT32 etbTopoCnt, UIN←T32 opTrnTopoCnt, TRDP_IP_ADDR_T srcIpAddr, TRDP_IP_ADDR_T destIpAddr, UINT32 interval, UINT32
redId, TRDP_FLAGS_T pktFlags, const TRDP_SEND_PARAM_T ∗pSendParam, const UINT8 ∗pData, U←INT32 dataSize)
Prepare for sending PD messages.

• EXT_DECL TRDP_ERR_T tlp_republish (TRDP_APP_SESSION_T appHandle, TRDP_PUB_T pubHandle,
UINT32 etbTopoCnt, UINT32 opTrnTopoCnt, TRDP_IP_ADDR_T srcIpAddr, TRDP_IP_ADDR_T destIpAddr)
Prepare for sending PD messages.

• TRDP_ERR_T tlp_unpublish (TRDP_APP_SESSION_T appHandle, TRDP_PUB_T pubHandle)
Stop sending PD messages.

• TRDP_ERR_T tlp_put (TRDP_APP_SESSION_T appHandle, TRDP_PUB_T pubHandle, const UINT8 ∗p←Data, UINT32 dataSize)
Update the process data to send.

• EXT_DECL TRDP_ERR_T tlc_getInterval (TRDP_APP_SESSION_T appHandle, TRDP_TIME_T ∗pInterval,
TRDP_FDS_T ∗pFileDesc, INT32 ∗pNoDesc)
Get the lowest time interval for PDs.

• EXT_DECL TRDP_ERR_T tlc_process (TRDP_APP_SESSION_T appHandle, TRDP_FDS_T ∗pRfds, INT32
∗pCount)
Generated by Doxygen

156

File Documentation

Work loop of the TRDP handler.

• EXT_DECL TRDP_ERR_T tlp_request (TRDP_APP_SESSION_T appHandle, TRDP_SUB_T subHandle,
UINT32 comId, UINT32 etbTopoCnt, UINT32 opTrnTopoCnt, TRDP_IP_ADDR_T srcIpAddr, TRDP_IP_AD←DR_T destIpAddr, UINT32 redId, TRDP_FLAGS_T pktFlags, const TRDP_SEND_PARAM_T ∗pSendParam,
const UINT8 ∗pData, UINT32 dataSize, UINT32 replyComId, TRDP_IP_ADDR_T replyIpAddr)
Initiate sending PD messages (PULL).

• EXT_DECL TRDP_ERR_T tlp_subscribe (TRDP_APP_SESSION_T appHandle, TRDP_SUB_T ∗pSub←Handle, const void ∗pUserRef, TRDP_PD_CALLBACK_T pfCbFunction, UINT32 comId, UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt, TRDP_IP_ADDR_T srcIpAddr1, TRDP_IP_ADDR_T srcIpAddr2, TRDP_IP_ADD←R_T destIpAddr, TRDP_FLAGS_T pktFlags, UINT32 timeout, TRDP_TO_BEHAVIOR_T toBehavior)
Prepare for receiving PD messages.

• EXT_DECL TRDP_ERR_T tlp_unsubscribe (TRDP_APP_SESSION_T appHandle, TRDP_SUB_T sub←Handle)
Stop receiving PD messages.

• EXT_DECL TRDP_ERR_T tlp_resubscribe (TRDP_APP_SESSION_T appHandle, TRDP_SUB_T sub←Handle, UINT32 etbTopoCnt, UINT32 opTrnTopoCnt, TRDP_IP_ADDR_T srcIpAddr1, TRDP_IP_ADDR_T
srcIpAddr2, TRDP_IP_ADDR_T destIpAddr)
Reprepare for receiving PD messages.

• EXT_DECL TRDP_ERR_T tlp_get (TRDP_APP_SESSION_T appHandle, TRDP_SUB_T subHandle, TR←DP_PD_INFO_T ∗pPdInfo, UINT8 ∗pData, UINT32 ∗pDataSize)
Get the last valid PD message.

5.17.1

Detailed Description

Functions for ECN communication.
Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.
Id
trdp_if.c 1772 2018-10-30 12:18:12Z bloehr

BL
BL
SW
BL
BL
BL
BL
BL
BL
BL
BL

2018-10-09:
2018-06-29:
2018-06-26:
2018-06-25:
2018-06-12:
2018-05-03:
2018-04-20:
2018-04-18:
2018-03-06:
2018-02-03:
2017-11-28:

Ticket #213 ComId 31 subscription removed (<-- undone!)
Default settings handling / compiler warnings
Ticket #205 tlm_addListener() does not acknowledge TRDP_FLAGS_DEFAULT flag
Ticket #201 tlp_setRedundant return value if redId is 0
Ticket #204 tlp_publish should take default callback function
Ticket #199 Setting redId on tlp_request() has no effect
Ticket #196 setRedundant with redId = 0 stops all publishers
MD notify: pass optional cb pointer to mdsend
Ticket #101 Optional callback function on PD send
Ticket #190 Source filtering (IP-range) for PD subscribe
Ticket #180 Filtering rules for DestinationURI does not follow the standard
Generated by Doxygen

5.17 trdp_if.c File Reference

BL
BL
BL
BL
BL
AHW
BL
BL
AHW
AHW
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL

2017-11-17:
2017-11-15:
2017-11-10:
2017-11-10:
2017-11-09:
2017-11-08:
2017-07-31:
2017-07-12:
2017-05-30:
2017-05-22:
2017-05-08:
2017-03-02:
2017-03-01:
2017-02-10:
2017-02-10:
2017-02-10:
2017-02-09:
2017-02-08:
2017-02-08:
2016-07-06:
2016-06-08:
2016-06-01:
2016-02-04:
2015-12-22:
2015-12-14:
2015-11-24:
2015-11-24:
2015-09-04:
2014-07-14:
2014-06-03:
2014-06-02:

BL
BL
BL
BL
BL
BL

2014-02-27:
2013-06-24:
2013-02-01:
2013-01-25:
2013-01-08:
2012-12-03:

superfluous session->redID replaced by sndQueue->redId
Ticket #1
Unjoin on unsubscribe/delListener (finally ;-)
Ticket #172 Infinite loop of message sending after PD Pull Request when registered in multicas
return error in resultCode of tlp_get()
Ticket #171 Wrong socket binding for multicast request messages
Ticket #179 Max. number of retries (part of sendParam) of a MD request needs to be checked
Ticket #168 Unnecessary multicast Join on tlp_publish()
Ticket #164 Fix for #151 (operator ’&’ instead of xor)
Ticket #143 tlm_replyErr() only at TRDP level allowed
Ticket #158 Infinit timeout at TRDB level is 0 acc. standard
Compiler warnings, local prototypes added
Ticket #151 tlp_request: timeout-flag is not cleared
Ticket #149 SourceUri and DestinationUri don’t with 32 characters
Ticket #137 tlc_closeSession should close the tcp socket used for md communication
Ticket #128 PD: Support of ComId == 0
Ticket #130 PD Pull: Request is always sent to the same ip address
Ticket #132 tlp_publish: Check of datasize wrong if using marshaller
Ticket #142: Compiler warnings / MISRA-C 2012 issues
Ticket #139: Swap parameter in tlm_reply
Ticket #122: 64Bit compatibility (+ compiler warnings)
Ticket #120: ComIds for statistics changed to proposed 61375 errata
Ticket #119 tlc_getInterval() repeatedly returns 0 after timeout
Late configuration update/merging
Mutex optimised in closeSession
Setter for default configuration added
Accessor for IP address of session
Ticket #104: PD telegrams with no data is never sent
Ticket #99: refCon for tlc_init()
Ticket #46: Protocol change: operational topocount needed
Do not return error on data-less tlp_request
Ticket #41: Sequence counter handling fixed
Removing receive queue on session close added
Ticket #24: trdp_if.c won’t compile without MD_SUPPORT
ID 125: Time-out handling and ready descriptors fixed
ID 53: Zero datset size fixed for PD
ID 20: Redundancy handling fixed
LADDER: Removed/Changed some ladder specific code in tlp_subscribe()
ID 1: "using uninitialized PD_ELE_T.pullIpAddress variable"
ID 2: "uninitialized PD_ELE_T newPD->pNext in tlp_subscribe()"

5.17.2

Function Documentation

5.17.2.1

tlc_closeSession()

EXT_DECL TRDP_ERR_T tlc_closeSession (
TRDP_APP_SESSION_T appHandle )

Close a session.
Clean up and release all resources of that session
Parameters
in appHandle

The handle returned by tlc_openSession

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

handle NULL

Generated by Doxygen

157

158

File Documentation

5.17.2.2

tlc_configSession()

EXT_DECL TRDP_ERR_T tlc_configSession (
TRDP_APP_SESSION_T appHandle,
const
const
const
const

TRDP_MARSHALL_CONFIG_T ∗ pMarshall,
TRDP_PD_CONFIG_T ∗ pPdDefault,
TRDP_MD_CONFIG_T ∗ pMdDefault,
TRDP_PROCESS_CONFIG_T ∗ pProcessConfig )

(Re-)configure a session.
tlc_configSession is called by openSession, but may also be called later on to change the defaults. Only the supplied
settings (pointer != NULL) will be evaluated.
Parameters
in appHandle

in
in
in
in

A handle for further calls to the trdp stack

pMarshall

Pointer to marshalling configuration

pPdDefault

Pointer to default PD configuration

pMdDefault

Pointer to default MD configuration

pProcessConfig

Pointer to process configuration only option parameter is used here to define session
behavior all other parameters are only used to feed statistics

Return values
TRDP_NO_ERR
TRDP_INIT_ERR
TRDP_PARAM_ERR

5.17.2.3

no error
not yet inited
parameter error

tlc_getETBTopoCount()

EXT_DECL UINT32 tlc_getETBTopoCount (
TRDP_APP_SESSION_T appHandle )

Set new topocount for trainwide communication.
This value is used for validating outgoing and incoming packets only!
Parameters
in appHandle

the handle returned by tlc_openSession

Return values
etbTopoCnt

Generated by Doxygen

5.17 trdp_if.c File Reference

5.17.2.4

159

tlc_getInterval()

EXT_DECL TRDP_ERR_T tlc_getInterval (
TRDP_APP_SESSION_T appHandle,
TRDP_TIME_T ∗ pInterval,
TRDP_FDS_T ∗ pFileDesc,
INT32 ∗ pNoDesc )

Get the lowest time interval for PDs.
Return the maximum time interval suitable for 'select()' so that we can send due PD packets in time. If the PD send
queue is empty, return zero time
Parameters

in
out
in,out
out

appHandle

The handle returned by tlc_openSession

pInterval

pointer to needed interval

pFileDesc

pointer to file descriptor set

pNoDesc

pointer to put no of highest used descriptors (for select())

Return values
TRDP_NO_ERR
TRDP_NOINIT_ERR

5.17.2.5

no error
handle invalid

tlc_getOpTrainTopoCount()

EXT_DECL UINT32 tlc_getOpTrainTopoCount (
TRDP_APP_SESSION_T appHandle )

Set new operational train topocount for direction/orientation sensitive communication.
This value is used for validating outgoing and incoming packets only!
Parameters
in appHandle

Return values
opTrnTopoCnt

Generated by Doxygen

The handle returned by tlc_openSession

New operational topocount value

160

5.17.2.6

File Documentation

tlc_getOwnIpAddress()

EXT_DECL TRDP_IP_ADDR_T tlc_getOwnIpAddress (
TRDP_APP_SESSION_T appHandle )

Get the interface address.
Parameters
out appHandle

A handle for further calls to the trdp stack

Return values
real←IP

5.17.2.7

tlc_getVersion()

EXT_DECL const TRDP_VERSION_T∗ tlc_getVersion (
void )

Return version.
Return pointer to version structure
Return values
TRDP_VERSION←_T

5.17.2.8

tlc_getVersionString()

const char∗ tlc_getVersionString (
void )

Return a human readable version representation.
Return string in the form 'v.r.u.b'
Return values
const string

Generated by Doxygen

5.17 trdp_if.c File Reference

5.17.2.9

161

tlc_init()

EXT_DECL TRDP_ERR_T tlc_init (
const TRDP_PRINT_DBG_T pPrintDebugString,
void ∗ pRefCon,
const TRDP_MEM_CONFIG_T ∗ pMemConfig )

Initialize the TRDP stack.
Support for message data can only be excluded during compile time!
tlc_init initializes the memory subsystem and takes a function pointer to an output function for logging.
Parameters
in pPrintDebugString

in
in

pRefCon

user context

pMemConfig

Pointer to memory configuration

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

5.17.2.10

Pointer to debug print function

no error
memory allocation failed
initialization error

tlc_openSession()

EXT_DECL TRDP_ERR_T tlc_openSession (
TRDP_APP_SESSION_T ∗ pAppHandle,
TRDP_IP_ADDR_T ownIpAddr,
TRDP_IP_ADDR_T leaderIpAddr,
const TRDP_MARSHALL_CONFIG_T ∗ pMarshall,
const TRDP_PD_CONFIG_T ∗ pPdDefault,
const TRDP_MD_CONFIG_T ∗ pMdDefault,
const TRDP_PROCESS_CONFIG_T ∗ pProcessConfig )

Open a session with the TRDP stack.
tlc_openSession returns in pAppHandle a unique handle to be used in further calls to the stack.
Parameters
out pAppHandle

A handle for further calls to the trdp stack

in

ownIpAddr

in
in
in
in
in

leaderIpAddr

Own IP address, can be different for each process in multihoming systems, if zero,
the default interface / IP will be used.
IP address of redundancy leader

pMarshall

Pointer to marshalling configuration

pPdDefault

Pointer to default PD configuration

pMdDefault

Pointer to default MD configuration

pProcessConfig

Pointer to process configuration only option parameter is used here to define session
behavior all other parameters are only used to feed statistics

Generated by Doxygen

162

File Documentation

Return values
TRDP_NO_ERR

no error

TRDP_INIT_ERR

not yet inited

TRDP_PARAM_ERR

parameter error

TRDP_SOCK_ERR

5.17.2.11

socket error

tlc_process()

EXT_DECL TRDP_ERR_T tlc_process (
TRDP_APP_SESSION_T appHandle,
TRDP_FDS_T ∗ pRfds,
INT32 ∗ pCount )

Work loop of the TRDP handler.
Search the queue for pending PDs to be sent Search the receive queue for pending PDs (time out)
Parameters

in
in
in,out

appHandle

The handle returned by tlc_openSession

pRfds

pointer to set of ready descriptors

pCount

pointer to number of ready descriptors

Return values
TRDP_NO_ERR
TRDP_NOINIT_ERR

5.17.2.12

no error
handle invalid

tlc_reinitSession()

EXT_DECL TRDP_ERR_T tlc_reinitSession (
TRDP_APP_SESSION_T appHandle )

Re-Initialize.
Should be called by the application when a link-down/link-up event has occured during normal operation. We need
to re-join the multicast groups...
Parameters
in appHandle

The handle returned by tlc_openSession

Return values
TRDP_NO_ERR

no error

Generated by Doxygen

5.17 trdp_if.c File Reference
Return values
TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

handle NULL

5.17.2.13

tlc_setETBTopoCount()

EXT_DECL TRDP_ERR_T tlc_setETBTopoCount (
TRDP_APP_SESSION_T appHandle,
UINT32 etbTopoCnt )

Set new topocount for trainwide communication.
This value is used for validating outgoing and incoming packets only!
Parameters
in appHandle

in

etbTopoCnt

the handle returned by tlc_openSession
New etbTopoCnt value

Return values
TRDP_NO_ERR
TRDP_NOINIT_ERR

5.17.2.14

no error
handle invalid

tlc_setOpTrainTopoCount()

EXT_DECL TRDP_ERR_T tlc_setOpTrainTopoCount (
TRDP_APP_SESSION_T appHandle,
UINT32 opTrnTopoCnt )

Set new operational train topocount for direction/orientation sensitive communication.
This value is used for validating outgoing and incoming packets only!
Parameters
in appHandle

in

opTrnTopoCnt

Return values
TRDP_NO_ERR
TRDP_NOINIT_ERR

Generated by Doxygen

The handle returned by tlc_openSession
New operational topocount value

no error
handle invalid

163

164

File Documentation

5.17.2.15

tlc_terminate()

EXT_DECL TRDP_ERR_T tlc_terminate (
void )

Un-Initialize.
Clean up and close all sessions. Mainly used for debugging/test runs. No further calls to library allowed
Return values
TRDP_NO_ERR

no error

TRDP_INIT_ERR

no error

TRDP_MEM_ERR
TRDP_MUTEX_ERR

5.17.2.16

TrafficStore nothing
TrafficStore mutex err

tlp_get()

EXT_DECL TRDP_ERR_T tlp_get (
TRDP_APP_SESSION_T appHandle,
TRDP_SUB_T subHandle,
TRDP_PD_INFO_T ∗ pPdInfo,
UINT8 ∗ pData,
UINT32 ∗ pDataSize )

Get the last valid PD message.
This allows polling of PDs instead of event driven handling by callbacks
Parameters

in
in
in,out
in,out
in,out

appHandle

the handle returned by tlc_openSession

subHandle

the handle returned by subscription

pPdInfo

pointer to application's info buffer

pData

pointer to application's data buffer

pDataSize

in: size of buffer, out: size of data

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_SUB_ERR
TRDP_TIMEOUT_ERR

no error
parameter error
not subscribed
packet timed out

TRDP_NOINIT_ERR

handle invalid

TRDP_COMID_ERR

ComID not found when marshalling

Generated by Doxygen

5.17 trdp_if.c File Reference

5.17.2.17

tlp_getRedundant()

EXT_DECL TRDP_ERR_T tlp_getRedundant (
TRDP_APP_SESSION_T appHandle,
UINT32 redId,
BOOL8 ∗ pLeader )

Get status of redundant ComIds.
Only the status of the first found redundancy group entry will be returned!
Parameters

in
in
in,out

appHandle

the handle returned by tlc_openSession

redId

will be returned for all ComID's with the given redId

pLeader

TRUE if we're sending this redundancy group (leader)

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

redId invalid or not existing

TRDP_NOINIT_ERR

handle invalid

5.17.2.18

tlp_publish()

EXT_DECL TRDP_ERR_T tlp_publish (
TRDP_APP_SESSION_T appHandle,
TRDP_PUB_T ∗ pPubHandle,
const void ∗ pUserRef,
TRDP_PD_CALLBACK_T pfCbFunction,
UINT32 comId,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
TRDP_IP_ADDR_T srcIpAddr,
TRDP_IP_ADDR_T destIpAddr,
UINT32 interval,
UINT32 redId,
TRDP_FLAGS_T pktFlags,
const TRDP_SEND_PARAM_T ∗ pSendParam,
const UINT8 ∗ pData,
UINT32 dataSize )

Prepare for sending PD messages.
Queue a PD message, it will be send when tlc_publish has been called
Parameters
in
appHandle
Generated by Doxygen

the handle returned by tlc_openSession

165

166

File Documentation

Parameters
out pPubHandle

returned handle for related re/unpublish

in
in
in
in
in
in
in
in
in
in

pUserRef

user supplied value returned within the info structure of callback function

pfCbFunction

Pointer to pre-send callback function, NULL if not used

comId

comId of packet to send

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr

own IP address, 0 - srcIP will be set by the stack

destIpAddr

where to send the packet to

interval

frequency of PD packet (>= 10ms) in usec

redId

0 - Non-redundant, > 0 valid redundancy group

pktFlags

OPTION: TRDP_FLAGS_DEFAULT, TRDP_FLAGS_NONE, TRDP_FLAGS_MARSHALL,
TRDP_FLAGS_CALLBACK

in
in
in

pSendParam

optional pointer to send parameter, NULL - default parameters are used

pData

pointer to data packet / dataset, NULL if sending starts later with tlp_put()

dataSize

size of data packet >= 0 and <= TRDP_MAX_PD_DATA_SIZE

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NOINIT_ERR

5.17.2.19

no error
parameter error
could not insert (out of memory)
handle invalid

tlp_put()

TRDP_ERR_T tlp_put (
TRDP_APP_SESSION_T appHandle,
TRDP_PUB_T pubHandle,
const UINT8 ∗ pData,
UINT32 dataSize )

Update the process data to send.
Update previously published data. The new telegram will be sent earliest when tlc_process is called.
Parameters

in
in
in,out
in,out

appHandle

the handle returned by tlc_openSession

pubHandle

the handle returned by publish

pData

pointer to application's data buffer

dataSize

size of data

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

no error
parameter error on uninitialized parameter or changed dataSize compared to
published one
Generated by Doxygen

5.17 trdp_if.c File Reference
Return values
TRDP_NOPUB_ERR

not published

TRDP_NOINIT_ERR

handle invalid

TRDP_COMID_ERR

ComID not found when marshalling

5.17.2.20

tlp_republish()

EXT_DECL TRDP_ERR_T tlp_republish (
TRDP_APP_SESSION_T appHandle,
TRDP_PUB_T pubHandle,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
TRDP_IP_ADDR_T srcIpAddr,
TRDP_IP_ADDR_T destIpAddr )

Prepare for sending PD messages.
Reinitialize and queue a PD message, it will be send when tlc_publish has been called
Parameters
in appHandle

in
in
in
in
in

pubHandle

handle for related unpublish

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr

own IP address, 0 - srcIP will be set by the stack

destIpAddr

where to send the packet to

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NOINIT_ERR

5.17.2.21

the handle returned by tlc_openSession

no error
parameter error
could not insert (out of memory)
handle invalid

tlp_request()

EXT_DECL TRDP_ERR_T tlp_request (
TRDP_APP_SESSION_T appHandle,
TRDP_SUB_T subHandle,
UINT32 comId,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
TRDP_IP_ADDR_T srcIpAddr,
TRDP_IP_ADDR_T destIpAddr,
Generated by Doxygen

167

168

File Documentation

UINT32 redId,
TRDP_FLAGS_T pktFlags,
const TRDP_SEND_PARAM_T ∗ pSendParam,
const UINT8 ∗ pData,
UINT32 dataSize,
UINT32 replyComId,
TRDP_IP_ADDR_T replyIpAddr )

Initiate sending PD messages (PULL).
Send a PD request message
Parameters
in appHandle

the handle returned by tlc_openSession

in
in
in
in
in
in
in
in

subHandle
comId

handle from related subscribe
comId of packet to be sent

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr

own IP address, 0 - srcIP will be set by the stack

destIpAddr

where to send the packet to

redId

0 - Non-redundant, > 0 valid redundancy group

pktFlags

OPTION: TRDP_FLAGS_DEFAULT, TRDP_FLAGS_NONE, TRDP_FLAGS_MARSHALL,
TRDP_FLAGS_CALLBACK

in
in
in
in
in

pSendParam

optional pointer to send parameter, NULL - default parameters are used

pData

pointer to packet data / dataset

dataSize

size of packet data

replyComId

comId of reply (default comID of subscription)

replyIpAddr

IP for reply

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR

no error
parameter error
could not insert (out of memory)

TRDP_NOINIT_ERR

handle invalid

TRDP_NOSUB_ERR

no matching subscription found

5.17.2.22

tlp_resubscribe()

EXT_DECL TRDP_ERR_T tlp_resubscribe (
TRDP_APP_SESSION_T appHandle,
TRDP_SUB_T subHandle,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
TRDP_IP_ADDR_T srcIpAddr1,
TRDP_IP_ADDR_T srcIpAddr2,
TRDP_IP_ADDR_T destIpAddr )

Reprepare for receiving PD messages.
Resubscribe to a specific PD ComID and source IP

Generated by Doxygen

5.17 trdp_if.c File Reference
Parameters
in appHandle

in
in
in
in
in
in

the handle returned by tlc_openSession

subHandle

handle for this subscription

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr1

Source IP address, lower address in case of address range, set to 0 if not used

srcIpAddr2

upper address in case of address range, set to 0 if not used

destIpAddr

IP address to join

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NOINIT_ERR
TRDP_SOCK_ERR

5.17.2.23

no error
parameter error
could not reserve memory (out of memory)
handle invalid
Resource (socket) not available, subscription canceled

tlp_setRedundant()

TRDP_ERR_T tlp_setRedundant (
TRDP_APP_SESSION_T appHandle,
UINT32 redId,
BOOL8 leader )

Do not send non-redundant PDs when we are follower.
Do not send redundant PD's when we are follower.
Parameters
in appHandle

in
in

the handle returned by tlc_openSession

redId

will be set for all ComID's with the given redId, 0 to change for all redId

leader

TRUE if we send

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

parameter error / redId not existing

TRDP_NOINIT_ERR

handle invalid

5.17.2.24

tlp_subscribe()

EXT_DECL TRDP_ERR_T tlp_subscribe (
TRDP_APP_SESSION_T appHandle,
Generated by Doxygen

169

170

File Documentation

TRDP_SUB_T ∗ pSubHandle,
const void ∗ pUserRef,
TRDP_PD_CALLBACK_T pfCbFunction,
UINT32 comId,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
TRDP_IP_ADDR_T srcIpAddr1,
TRDP_IP_ADDR_T srcIpAddr2,
TRDP_IP_ADDR_T destIpAddr,
TRDP_FLAGS_T pktFlags,
UINT32 timeout,
TRDP_TO_BEHAVIOR_T toBehavior )

Prepare for receiving PD messages.
Subscribe to a specific PD ComID and source IP.
Parameters
in
appHandle

the handle returned by tlc_openSession

out
in
in
in
in
in
in
in
in

pSubHandle

return a handle for this subscription

pUserRef

user supplied value returned within the info structure

pfCbFunction

Pointer to subscriber specific callback function, NULL to use default function

comId

comId of packet to receive

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr1

Source IP address, lower address in case of address range, set to 0 if not used

srcIpAddr2

upper address in case of address range, set to 0 if not used

pktFlags

OPTION: TRDP_FLAGS_DEFAULT, TRDP_FLAGS_NONE, TRDP_FLAGS_MARSHALL,
TRDP_FLAGS_CALLBACK

in
in
in

destIpAddr

IP address to join

timeout

timeout (>= 10ms) in usec

toBehavior

timeout behavior

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NOINIT_ERR

5.17.2.25

no error
parameter error
could not reserve memory (out of memory)
handle invalid

tlp_unpublish()

TRDP_ERR_T tlp_unpublish (
TRDP_APP_SESSION_T appHandle,
TRDP_PUB_T pubHandle )

Stop sending PD messages.

Generated by Doxygen

5.17 trdp_if.c File Reference
Parameters
in appHandle

in

pubHandle

the handle returned by tlc_openSession
the handle returned by prepare

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

parameter error

TRDP_NOPUB_ERR

not published

TRDP_NOINIT_ERR

handle invalid

5.17.2.26

tlp_unsubscribe()

EXT_DECL TRDP_ERR_T tlp_unsubscribe (
TRDP_APP_SESSION_T appHandle,
TRDP_SUB_T subHandle )

Stop receiving PD messages.
Unsubscribe to a specific PD ComID
Parameters
in appHandle

in

subHandle

the handle returned by tlc_openSession
the handle for this subscription

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

parameter error

TRDP_NOSUB_ERR

not subscribed

TRDP_NOINIT_ERR

handle invalid

5.17.2.27

trdp_isValidSession()

BOOL8 trdp_isValidSession (
TRDP_APP_SESSION_T pSessionHandle )

Check if the session handle is valid.
Parameters
in pSessionHandle

Generated by Doxygen

pointer to packet data (dataset)

171

172

File Documentation

Return values
TRUE is valid
FALSE is invalid

5.17.2.28

trdp_sessionQueue()

TRDP_APP_SESSION_T ∗ trdp_sessionQueue (
void )

Get the session queue head pointer.
Return values
&sSession

5.18

trdp_if.h File Reference

Typedefs for TRDP communication.
Generated by Doxygen

5.18 trdp_if.h File Reference

173

#include "trdp_if_light.h"
Include dependency graph for trdp_if.h:

trdp_if.h

trdp_if_light.h

trdp_types.h

vos_mem.h

vos_sock.h

vos_thread.h

iec61375-2-3.h

vos_private.h

vos_types.h

stdint.h

This graph shows which files directly or indirectly include this file:

trdp_if.h

trdp_mdcom.c

trdp_pdcom.c

trdp_stats.c

Functions
• BOOL8 trdp_isValidSession (TRDP_APP_SESSION_T pSessionHandle)
Generated by Doxygen

trdp_utils.c

174

File Documentation

Check if the session handle is valid.

• TRDP_APP_SESSION_T ∗ trdp_sessionQueue (void)
Get the session queue head pointer.

5.18.1

Detailed Description

Typedefs for TRDP communication.

Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.

Id
trdp_if.h 1264 2014-07-14 15:54:26Z bloehr

BL 2014-07-14: Ticket #46: Protocol change: operational topocount needed

5.18.2

Function Documentation

5.18.2.1

trdp_isValidSession()

BOOL8 trdp_isValidSession (
TRDP_APP_SESSION_T pSessionHandle )

Check if the session handle is valid.
Parameters
in pSessionHandle

pointer to packet data (dataset)

Return values
TRUE is valid
FALSE is invalid

Generated by Doxygen

5.19 trdp_if_light.h File Reference

5.18.2.2

175

trdp_sessionQueue()

TRDP_APP_SESSION_T∗ trdp_sessionQueue (
void )

Get the session queue head pointer.
Return values
&sSession

5.19

trdp_if_light.h File Reference

TRDP Light interface functions (API)

#include "trdp_types.h"
Include dependency graph for trdp_if_light.h:

trdp_if_light.h

trdp_types.h

vos_mem.h

vos_thread.h

vos_types.h

stdint.h

Generated by Doxygen

vos_sock.h

iec61375-2-3.h

vos_private.h

176

File Documentation

This graph shows which files directly or indirectly include this file:

trdp_if_light.h

tau_cstinfo.c

tau_ctrl.c

tau_dnr.c

tau_marshall.c

tau_tti.c

trdp_if.c

trdp_stats.h

trdp_pdcom.c

trdp_if.h

trdp_stats.c

trdp_utils.c

trdp_mdcom.c

Functions
• EXT_DECL TRDP_ERR_T tlc_init (const TRDP_PRINT_DBG_T pPrintDebugString, void ∗pRefCon, const
TRDP_MEM_CONFIG_T ∗pMemConfig)
Support for message data can only be excluded during compile time!

• EXT_DECL TRDP_ERR_T tlc_openSession (TRDP_APP_SESSION_T ∗pAppHandle, TRDP_IP_ADDR←_T ownIpAddr, TRDP_IP_ADDR_T leaderIpAddr, const TRDP_MARSHALL_CONFIG_T ∗pMarshall, const
TRDP_PD_CONFIG_T ∗pPdDefault, const TRDP_MD_CONFIG_T ∗pMdDefault, const TRDP_PROCES←S_CONFIG_T ∗pProcessConfig)
Open a session with the TRDP stack.

• EXT_DECL TRDP_ERR_T tlc_reinitSession (TRDP_APP_SESSION_T appHandle)
Re-Initialize.

• EXT_DECL TRDP_ERR_T tlc_configSession (TRDP_APP_SESSION_T appHandle, const TRDP_MAR←SHALL_CONFIG_T ∗pMarshall, const TRDP_PD_CONFIG_T ∗pPdDefault, const TRDP_MD_CONFIG_T
∗pMdDefault, const TRDP_PROCESS_CONFIG_T ∗pProcessConfig)
(Re-)configure a session.

• EXT_DECL TRDP_ERR_T tlc_closeSession (TRDP_APP_SESSION_T appHandle)
Close a session.

• EXT_DECL TRDP_ERR_T tlc_terminate (void)
Un-Initialize.

• EXT_DECL TRDP_ERR_T tlc_setETBTopoCount (TRDP_APP_SESSION_T appHandle, UINT32 etbTopo←Cnt)
Set new topocount for trainwide communication.

• EXT_DECL UINT32 tlc_getETBTopoCount (TRDP_APP_SESSION_T appHandle)
Set new topocount for trainwide communication.

• EXT_DECL TRDP_ERR_T tlc_setOpTrainTopoCount (TRDP_APP_SESSION_T appHandle, UINT32 op←TrnTopoCnt)
Set new operational train topocount for direction/orientation sensitive communication.

• EXT_DECL UINT32 tlc_getOpTrainTopoCount (TRDP_APP_SESSION_T appHandle)
Set new operational train topocount for direction/orientation sensitive communication.

• EXT_DECL TRDP_ERR_T tlc_freeBuf (TRDP_APP_SESSION_T appHandle, char ∗pBuf)
Frees the buffer reserved by the TRDP layer.

• EXT_DECL TRDP_ERR_T tlc_getInterval (TRDP_APP_SESSION_T appHandle, TRDP_TIME_T ∗pInterval,
TRDP_FDS_T ∗pFileDesc, INT32 ∗pNoDesc)
Get the lowest time interval for PDs.

• EXT_DECL TRDP_ERR_T tlc_process (TRDP_APP_SESSION_T appHandle, TRDP_FDS_T ∗pRfds, INT32
∗pCount)
Work loop of the TRDP handler.

• EXT_DECL TRDP_IP_ADDR_T tlc_getOwnIpAddress (TRDP_APP_SESSION_T appHandle)
Get the interface address.
Generated by Doxygen

5.19 trdp_if_light.h File Reference

177

• EXT_DECL TRDP_ERR_T tlp_publish (TRDP_APP_SESSION_T appHandle, TRDP_PUB_T ∗pPubHandle,
const void ∗pUserRef, TRDP_PD_CALLBACK_T pfCbFunction, UINT32 comId, UINT32 etbTopoCnt, UIN←T32 opTrnTopoCnt, TRDP_IP_ADDR_T srcIpAddr, TRDP_IP_ADDR_T destIpAddr, UINT32 interval, UINT32
redId, TRDP_FLAGS_T pktFlags, const TRDP_SEND_PARAM_T ∗pSendParam, const UINT8 ∗pData, U←INT32 dataSize)
Prepare for sending PD messages.

• EXT_DECL TRDP_ERR_T tlp_republish (TRDP_APP_SESSION_T appHandle, TRDP_PUB_T pubHandle,
UINT32 etbTopoCnt, UINT32 opTrnTopoCnt, TRDP_IP_ADDR_T srcIpAddr, TRDP_IP_ADDR_T destIpAddr)
Prepare for sending PD messages.

• EXT_DECL TRDP_ERR_T tlp_unpublish (TRDP_APP_SESSION_T appHandle, TRDP_PUB_T pubHandle)
Stop sending PD messages.

• EXT_DECL TRDP_ERR_T tlp_put (TRDP_APP_SESSION_T appHandle, TRDP_PUB_T pubHandle, const
UINT8 ∗pData, UINT32 dataSize)
Update the process data to send.

• EXT_DECL TRDP_ERR_T tlp_setRedundant (TRDP_APP_SESSION_T appHandle, UINT32 redId, BOOL8
leader)
Do not send redundant PD's when we are follower.

• EXT_DECL TRDP_ERR_T tlp_getRedundant (TRDP_APP_SESSION_T appHandle, UINT32 redId, BOOL8
∗pLeader)
Get status of redundant ComIds.

• EXT_DECL TRDP_ERR_T tlp_request (TRDP_APP_SESSION_T appHandle, TRDP_SUB_T subHandle,
UINT32 comId, UINT32 etbTopoCnt, UINT32 opTrnTopoCnt, TRDP_IP_ADDR_T srcIpAddr, TRDP_IP_AD←DR_T destIpAddr, UINT32 redId, TRDP_FLAGS_T pktFlags, const TRDP_SEND_PARAM_T ∗pSendParam,
const UINT8 ∗pData, UINT32 dataSize, UINT32 replyComId, TRDP_IP_ADDR_T replyIpAddr)
Initiate sending PD messages (PULL).

• EXT_DECL TRDP_ERR_T tlp_subscribe (TRDP_APP_SESSION_T appHandle, TRDP_SUB_T ∗pSub←Handle, const void ∗pUserRef, TRDP_PD_CALLBACK_T pfCbFunction, UINT32 comId, UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt, TRDP_IP_ADDR_T srcIpAddr1, TRDP_IP_ADDR_T srcIpAddr2, TRDP_IP_ADD←R_T destIpAddr, TRDP_FLAGS_T pktFlags, UINT32 timeout, TRDP_TO_BEHAVIOR_T toBehavior)
Prepare for receiving PD messages.

• EXT_DECL TRDP_ERR_T tlp_resubscribe (TRDP_APP_SESSION_T appHandle, TRDP_SUB_T sub←Handle, UINT32 etbTopoCnt, UINT32 opTrnTopoCnt, TRDP_IP_ADDR_T srcIpAddr1, TRDP_IP_ADDR_T
srcIpAddr2, TRDP_IP_ADDR_T destIpAddr)
Reprepare for receiving PD messages.

• EXT_DECL TRDP_ERR_T tlp_unsubscribe (TRDP_APP_SESSION_T appHandle, TRDP_SUB_T sub←Handle)
Stop receiving PD messages.

• EXT_DECL TRDP_ERR_T tlp_get (TRDP_APP_SESSION_T appHandle, TRDP_SUB_T subHandle, TR←DP_PD_INFO_T ∗pPdInfo, UINT8 ∗pData, UINT32 ∗pDataSize)
Get the last valid PD message.

• EXT_DECL TRDP_ERR_T tlm_notify (TRDP_APP_SESSION_T appHandle, const void ∗pUserRef, TRD←P_MD_CALLBACK_T pfCbFunction, UINT32 comId, UINT32 etbTopoCnt, UINT32 opTrnTopoCnt, TRDP_←IP_ADDR_T srcIpAddr, TRDP_IP_ADDR_T destIpAddr, TRDP_FLAGS_T pktFlags, const TRDP_SEND_←PARAM_T ∗pSendParam, const UINT8 ∗pData, UINT32 dataSize, const TRDP_URI_USER_T sourceURI,
const TRDP_URI_USER_T destURI)
Initiate sending MD notification message.

• EXT_DECL TRDP_ERR_T tlm_request (TRDP_APP_SESSION_T appHandle, const void ∗pUserRef, T←RDP_MD_CALLBACK_T pfCbFunction, TRDP_UUID_T ∗pSessionId, UINT32 comId, UINT32 etbTopo←Cnt, UINT32 opTrnTopoCnt, TRDP_IP_ADDR_T srcIpAddr, TRDP_IP_ADDR_T destIpAddr, TRDP_FLA←GS_T pktFlags, UINT32 numReplies, UINT32 replyTimeout, const TRDP_SEND_PARAM_T ∗pSendParam,
const UINT8 ∗pData, UINT32 dataSize, const TRDP_URI_USER_T sourceURI, const TRDP_URI_USER_T
destURI)
Initiate sending MD request message.

• EXT_DECL TRDP_ERR_T tlm_confirm (TRDP_APP_SESSION_T appHandle, const TRDP_UUID_T ∗p←SessionId, UINT16 userStatus, const TRDP_SEND_PARAM_T ∗pSendParam)
Generated by Doxygen

178

File Documentation

Initiate sending MD confirm message.

• EXT_DECL TRDP_ERR_T tlm_abortSession (TRDP_APP_SESSION_T appHandle, const TRDP_UUID_T
∗pSessionId)
Cancel an open session.

• EXT_DECL TRDP_ERR_T tlm_addListener (TRDP_APP_SESSION_T appHandle, TRDP_LIS_T ∗pListen←Handle, const void ∗pUserRef, TRDP_MD_CALLBACK_T pfCbFunction, BOOL8 comIdListener, UINT32
comId, UINT32 etbTopoCnt, UINT32 opTrnTopoCnt, TRDP_IP_ADDR_T srcIpAddr1, TRDP_IP_ADDR_←T srcIpAddr2, TRDP_IP_ADDR_T mcDestIpAddr, TRDP_FLAGS_T pktFlags, const TRDP_URI_USER_T
srcURI, const TRDP_URI_USER_T destURI)
Subscribe to MD messages.

• EXT_DECL TRDP_ERR_T tlm_readdListener (TRDP_APP_SESSION_T appHandle, TRDP_LIS_T listen←Handle, UINT32 etbTopoCnt, UINT32 opTrnTopoCnt, TRDP_IP_ADDR_T srcIpAddr, TRDP_IP_ADDR_←T srcIpAddr2, TRDP_IP_ADDR_T mcDestIpAddr)
Resubscribe to MD messages.

• EXT_DECL TRDP_ERR_T tlm_delListener (TRDP_APP_SESSION_T appHandle, TRDP_LIS_T listen←Handle)
Remove Listener.

• TRDP_ERR_T tlm_reply (TRDP_APP_SESSION_T appHandle, const TRDP_UUID_T ∗pSessionId, UINT32
comId, UINT16 userStatus, const TRDP_SEND_PARAM_T ∗pSendParam, const UINT8 ∗pData, UINT32
dataSize)
Send a MD reply message.

• TRDP_ERR_T tlm_replyQuery (TRDP_APP_SESSION_T appHandle, const TRDP_UUID_T ∗pSessionId,
UINT32 comId, UINT16 userStatus, UINT32 confirmTimeout, const TRDP_SEND_PARAM_T ∗pSendParam,
const UINT8 ∗pData, UINT32 dataSize)
Send a MD reply query message.

• EXT_DECL const CHAR8 ∗ tlc_getVersionString (void)
Return a human readable version representation.

• EXT_DECL const TRDP_VERSION_T ∗ tlc_getVersion (void)
Return version.

• EXT_DECL TRDP_ERR_T tlc_getStatistics (TRDP_APP_SESSION_T appHandle, TRDP_STATISTICS_T
∗pStatistics)
Return statistics.

• EXT_DECL TRDP_ERR_T tlc_getSubsStatistics (TRDP_APP_SESSION_T appHandle, UINT16 ∗pNum←Subs, TRDP_SUBS_STATISTICS_T ∗pStatistics)
Return PD subscription statistics.

• EXT_DECL TRDP_ERR_T tlc_getPubStatistics (TRDP_APP_SESSION_T appHandle, UINT16 ∗pNumPub,
TRDP_PUB_STATISTICS_T ∗pStatistics)
Return PD publish statistics.

• EXT_DECL TRDP_ERR_T tlc_getUdpListStatistics (TRDP_APP_SESSION_T appHandle, UINT16 ∗p←NumList, TRDP_LIST_STATISTICS_T ∗pStatistics)
Return UDP MD listener statistics.

• EXT_DECL TRDP_ERR_T tlc_getTcpListStatistics (TRDP_APP_SESSION_T appHandle, UINT16 ∗pNum←List, TRDP_LIST_STATISTICS_T ∗pStatistics)
Return TCP MD listener statistics.

• EXT_DECL TRDP_ERR_T tlc_getRedStatistics (TRDP_APP_SESSION_T appHandle, UINT16 ∗pNumRed,
TRDP_RED_STATISTICS_T ∗pStatistics)
Return redundancy group statistics.

• EXT_DECL TRDP_ERR_T tlc_getJoinStatistics (TRDP_APP_SESSION_T appHandle, UINT16 ∗pNumJoin,
UINT32 ∗pIpAddr)
Return join statistics.

• EXT_DECL TRDP_ERR_T tlc_resetStatistics (TRDP_APP_SESSION_T appHandle)
Reset statistics.
Generated by Doxygen

5.19 trdp_if_light.h File Reference

5.19.1

179

Detailed Description

TRDP Light interface functions (API)
Low level functions for communicating using the TRDP protocol

Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.

Id
trdp_if_light.h 1711 2018-03-06 16:11:32Z bloehr

BL
BL
BL
AHW
AHW
BL
BL
BL

2018-03-06:
2018-02-03:
2017-11-28:
2017-11-08:
2017-05-30:
2015-11-24:
2015-09-04:
2014-07-14:

Ticket #101 Optional callback function on PD send
Ticket #190 Source filtering (IP-range) for PD subscribe
Ticket #180 Filtering rules for DestinationURI does not follow the standard
Ticket #179 Max. number of retries (part of sendParam) of a MD request needs to be checked
Ticket #143 tlm_replyErr() only at TRDP level allowed
Accessor for IP address of session
Ticket #99: refCon for tlc_init()
Ticket #46: Protocol change: operational topocount needed

5.19.2

Function Documentation

5.19.2.1

tlc_closeSession()

EXT_DECL TRDP_ERR_T tlc_closeSession (
TRDP_APP_SESSION_T appHandle )

Close a session.
Clean up and release all resources of that session
Parameters
in appHandle

Generated by Doxygen

The handle returned by tlc_openSession

180

File Documentation

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

handle NULL

5.19.2.2

tlc_configSession()

EXT_DECL TRDP_ERR_T tlc_configSession (
TRDP_APP_SESSION_T appHandle,
const TRDP_MARSHALL_CONFIG_T ∗ pMarshall,
const TRDP_PD_CONFIG_T ∗ pPdDefault,
const TRDP_MD_CONFIG_T ∗ pMdDefault,
const TRDP_PROCESS_CONFIG_T ∗ pProcessConfig )

(Re-)configure a session.
tlc_configSession is called by openSession, but may also be called later on to change the defaults.
Parameters
in appHandle

in
in
in
in

A handle for further calls to the trdp stack

pMarshall

Pointer to marshalling configuration

pPdDefault

Pointer to default PD configuration

pMdDefault

Pointer to default MD configuration

pProcessConfig

Pointer to process configuration only option parameter is used here to define session
behavior all other parameters are only used to feed statistics

Return values
TRDP_NO_ERR
TRDP_INIT_ERR
TRDP_PARAM_ERR

no error
not yet inited
parameter error

tlc_configSession is called by openSession, but may also be called later on to change the defaults. Only the supplied
settings (pointer != NULL) will be evaluated.
Parameters
in appHandle

in
in
in
in

A handle for further calls to the trdp stack

pMarshall

Pointer to marshalling configuration

pPdDefault

Pointer to default PD configuration

pMdDefault

Pointer to default MD configuration

pProcessConfig

Pointer to process configuration only option parameter is used here to define session
behavior all other parameters are only used to feed statistics

Return values
TRDP_NO_ERR

no error

Generated by Doxygen

5.19 trdp_if_light.h File Reference
Return values
TRDP_INIT_ERR
TRDP_PARAM_ERR

5.19.2.3

not yet inited
parameter error

tlc_freeBuf()

EXT_DECL TRDP_ERR_T tlc_freeBuf (
TRDP_APP_SESSION_T appHandle,
char ∗ pBuf )

Frees the buffer reserved by the TRDP layer.
Parameters
in appHandle

in

pBuf

The handle returned by tlc_openSession
pointer to the buffer to be freed

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

buffer pointer invalid

5.19.2.4

tlc_getETBTopoCount()

EXT_DECL UINT32 tlc_getETBTopoCount (
TRDP_APP_SESSION_T appHandle )

Set new topocount for trainwide communication.
This value is used for validating outgoing and incoming packets only!
Parameters
in appHandle

Return values
etbTopoCnt

Generated by Doxygen

the handle returned by tlc_openSession

181

182

5.19.2.5

File Documentation

tlc_getInterval()

EXT_DECL TRDP_ERR_T tlc_getInterval (
TRDP_APP_SESSION_T appHandle,
TRDP_TIME_T ∗ pInterval,
TRDP_FDS_T ∗ pFileDesc,
INT32 ∗ pNoDesc )

Get the lowest time interval for PDs.
Return the maximum time interval suitable for 'select()' so that we can send due PD packets in time. If the PD send
queue is empty, return zero time
Parameters

in
out
in,out
out

appHandle

The handle returned by tlc_openSession

pInterval

pointer to needed interval

pFileDesc

pointer to file descriptor set

pNoDesc

pointer to put no of used descriptors (for select())

Return values
TRDP_NO_ERR
TRDP_NOINIT_ERR

no error
handle invalid

Return the maximum time interval suitable for 'select()' so that we can send due PD packets in time. If the PD send
queue is empty, return zero time
Parameters

in
out
in,out
out

appHandle

The handle returned by tlc_openSession

pInterval

pointer to needed interval

pFileDesc

pointer to file descriptor set

pNoDesc

pointer to put no of highest used descriptors (for select())

Return values
TRDP_NO_ERR
TRDP_NOINIT_ERR

5.19.2.6

no error
handle invalid

tlc_getJoinStatistics()

EXT_DECL TRDP_ERR_T tlc_getJoinStatistics (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pNumJoin,
UINT32 ∗ pIpAddr )

Return join statistics.
Memory for statistics information must be provided by the user. The reserved length is given via pNumJoin implicitely.

Generated by Doxygen

5.19 trdp_if_light.h File Reference
Parameters

in
in,out
out

appHandle

the handle returned by tlc_openSession

pNumJoin

Pointer to the number of joined IP Adresses

pIpAddr

Pointer to a list with the joined IP adresses

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

TRDP_MEM_ERR

there are more items than requested

Memory for statistics information must be provided by the user.
Parameters

in
in,out
out

appHandle

the handle returned by tlc_openSession

pNumJoin

Pointer to the number of joined IP Adresses

pIpAddr

Pointer to a list with the joined IP adresses

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

TRDP_MEM_ERR

5.19.2.7

there are more items than requested

tlc_getOpTrainTopoCount()

EXT_DECL UINT32 tlc_getOpTrainTopoCount (
TRDP_APP_SESSION_T appHandle )

Set new operational train topocount for direction/orientation sensitive communication.
This value is used for validating outgoing and incoming packets only!
Parameters
in appHandle

Return values
opTrnTopoCnt

Generated by Doxygen

The handle returned by tlc_openSession

New operational topocount value

183

184

File Documentation

5.19.2.8

tlc_getOwnIpAddress()

EXT_DECL TRDP_IP_ADDR_T tlc_getOwnIpAddress (
TRDP_APP_SESSION_T appHandle )

Get the interface address.
Parameters
out appHandle

A handle for further calls to the trdp stack

Return values
real←IP

5.19.2.9

tlc_getPubStatistics()

EXT_DECL TRDP_ERR_T tlc_getPubStatistics (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pNumPub,
TRDP_PUB_STATISTICS_T ∗ pStatistics )

Return PD publish statistics.
Memory for statistics information must be provided by the user. The reserved length is given via pNumPub implicitely.
Parameters

in
in,out
out

appHandle

the handle returned by tlc_openSession

pNumPub

Pointer to the number of publishers

pStatistics

pointer to a list with the publish statistics information

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

TRDP_MEM_ERR

there are more subscriptions than requested

Memory for statistics information must be provided by the user.
Parameters

in
in,out
out

appHandle

the handle returned by tlc_openSession

pNumPub

Pointer to the number of publishers

pStatistics

Pointer to a list with the publish statistics information

Generated by Doxygen

5.19 trdp_if_light.h File Reference
Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

TRDP_MEM_ERR

5.19.2.10

185

there are more subscriptions than requested

tlc_getRedStatistics()

EXT_DECL TRDP_ERR_T tlc_getRedStatistics (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pNumRed,
TRDP_RED_STATISTICS_T ∗ pStatistics )

Return redundancy group statistics.
Memory for statistics information must be provided by the user. The reserved length is given via pNumRed implicitely.
Parameters

in
in,out
out

appHandle

the handle returned by tlc_openSession

pNumRed

Pointer to the number of redundancy groups

pStatistics

Pointer to a list with the redundancy group information

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

TRDP_MEM_ERR

there are more subscriptions than requested

Memory for statistics information must be provided by the user.
Parameters

in
in,out
out

appHandle

the handle returned by tlc_openSession

pNumRed

Pointer to the number of redundancy groups

pStatistics

Pointer to a list with the redundancy group information

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

TRDP_MEM_ERR

Generated by Doxygen

there are more subscriptions than requested

186

5.19.2.11

File Documentation

tlc_getStatistics()

EXT_DECL TRDP_ERR_T tlc_getStatistics (
TRDP_APP_SESSION_T appHandle,
TRDP_STATISTICS_T ∗ pStatistics )

Return statistics.
Memory for statistics information must be preserved by the user.
Parameters
in
appHandle

out

pStatistics

the handle returned by tlc_openSession
Pointer to statistics for this application session

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

Memory for statistics information must be provided by the user.
Parameters
in
appHandle

out

pStatistics

the handle returned by tlc_openSession
Pointer to statistics for this application session

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

5.19.2.12

tlc_getSubsStatistics()

EXT_DECL TRDP_ERR_T tlc_getSubsStatistics (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pNumSubs,
TRDP_SUBS_STATISTICS_T ∗ pStatistics )

Return PD subscription statistics.
Memory for statistics information must be provided by the user. The reserved length is given via pNumSub implicitely.
Parameters

in
in,out
in,out

appHandle

the handle returned by tlc_openSession

pNumSubs

In: The number of subscriptions requested Out: Number of subscriptions returned

pStatistics

Pointer to an array with the subscription statistics information
Generated by Doxygen

5.19 trdp_if_light.h File Reference
Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

TRDP_MEM_ERR

187

there are more subscriptions than requested

Memory for statistics information must be provided by the user.
Parameters

in
in,out
in,out

appHandle

the handle returned by tlc_openSession

pNumSubs

In: The number of subscriptions requested Out: Number of subscriptions returned

pStatistics

Pointer to an array with the subscription statistics information

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

TRDP_MEM_ERR

5.19.2.13

there are more subscriptions than requested

tlc_getTcpListStatistics()

EXT_DECL TRDP_ERR_T tlc_getTcpListStatistics (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pNumList,
TRDP_LIST_STATISTICS_T ∗ pStatistics )

Return TCP MD listener statistics.
Memory for statistics information must be provided by the user. The reserved length is given via pNumLis implicitely.
Parameters

in
in,out
out

appHandle

the handle returned by tlc_openSession

pNumList

Pointer to the number of listeners

pStatistics

Pointer to a list with the listener statistics information

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

TRDP_MEM_ERR

Generated by Doxygen

there are more subscriptions than requested

188

File Documentation

5.19.2.14

tlc_getUdpListStatistics()

EXT_DECL TRDP_ERR_T tlc_getUdpListStatistics (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pNumList,
TRDP_LIST_STATISTICS_T ∗ pStatistics )

Return UDP MD listener statistics.
Memory for statistics information must be provided by the user. The reserved length is given via pNumLis implicitely.
Parameters

in
in,out
out

appHandle

the handle returned by tlc_openSession

pNumList

Pointer to the number of listeners

pStatistics

Pointer to a list with the listener statistics information

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

TRDP_MEM_ERR

5.19.2.15

there are more subscriptions than requested

tlc_getVersion()

EXT_DECL const TRDP_VERSION_T∗ tlc_getVersion (
void )

Return version.
Return pointer to version structure
Return values
const TRDP_VERSION←_T

Return pointer to version structure
Return values
TRDP_VERSION←_T

Generated by Doxygen

5.19 trdp_if_light.h File Reference

5.19.2.16

tlc_getVersionString()

EXT_DECL const CHAR8∗ tlc_getVersionString (
void

)

Return a human readable version representation.
Return string in the form 'v.r.u.b'
Return values
const string

5.19.2.17

tlc_init()

EXT_DECL TRDP_ERR_T tlc_init (
const TRDP_PRINT_DBG_T pPrintDebugString,
void ∗ pRefCon,
const TRDP_MEM_CONFIG_T ∗ pMemConfig )

Support for message data can only be excluded during compile time!
Initialize the TRDP stack.
tlc_init initializes the memory subsystem and takes a function pointer to an output function for logging.
Parameters
in pPrintDebugString

in
in

Pointer to debug print function

pRefCon

user context

pMemConfig

Pointer to memory configuration

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

no error
memory allocation failed
initialization error

Support for message data can only be excluded during compile time!
tlc_init initializes the memory subsystem and takes a function pointer to an output function for logging.
Parameters
in pPrintDebugString

in
in

Pointer to debug print function

pRefCon

user context

pMemConfig

Pointer to memory configuration

Generated by Doxygen

189

190

File Documentation

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_PARAM_ERR

5.19.2.18

no error
memory allocation failed
initialization error

tlc_openSession()

EXT_DECL TRDP_ERR_T tlc_openSession (
TRDP_APP_SESSION_T ∗ pAppHandle,
TRDP_IP_ADDR_T ownIpAddr,
TRDP_IP_ADDR_T leaderIpAddr,
const
const
const
const

TRDP_MARSHALL_CONFIG_T ∗ pMarshall,
TRDP_PD_CONFIG_T ∗ pPdDefault,
TRDP_MD_CONFIG_T ∗ pMdDefault,
TRDP_PROCESS_CONFIG_T ∗ pProcessConfig )

Open a session with the TRDP stack.
tlc_openSession returns in pAppHandle a unique handle to be used in further calls to the stack.
Parameters
out pAppHandle

A handle for further calls to the trdp stack

in

ownIpAddr

in
in
in
in
in

leaderIpAddr

Own IP address, can be different for each process in multihoming systems, if zero,
the default interface / IP will be used.
IP address of redundancy leader

pMarshall

Pointer to marshalling configuration

pPdDefault

Pointer to default PD configuration

pMdDefault

Pointer to default MD configuration

pProcessConfig

Pointer to process configuration only option parameter is used here to define session
behavior all other parameters are only used to feed statistics

Return values
TRDP_NO_ERR
TRDP_INIT_ERR
TRDP_PARAM_ERR
TRDP_SOCK_ERR

5.19.2.19

no error
not yet inited
parameter error
socket error

tlc_process()

EXT_DECL TRDP_ERR_T tlc_process (
TRDP_APP_SESSION_T appHandle,
TRDP_FDS_T ∗ pRfds,
INT32 ∗ pCount )
Generated by Doxygen

5.19 trdp_if_light.h File Reference

191

Work loop of the TRDP handler.
Search the queue for pending PDs to be sent Search the receive queue for pending PDs (time out)
Parameters

in
in
in,out

appHandle

The handle returned by tlc_openSession

pRfds

pointer to set of ready descriptors

pCount

pointer to number of ready descriptors

Return values
TRDP_NO_ERR
TRDP_NOINIT_ERR

5.19.2.20

no error
handle invalid

tlc_reinitSession()

EXT_DECL TRDP_ERR_T tlc_reinitSession (
TRDP_APP_SESSION_T appHandle )

Re-Initialize.
Should be called by the application when a link-down/link-up event has occured during normal operation. We need
to re-join the multicast groups...
Parameters
in appHandle

The handle returned by tlc_openSession

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

handle NULL

5.19.2.21

tlc_resetStatistics()

EXT_DECL TRDP_ERR_T tlc_resetStatistics (
TRDP_APP_SESSION_T appHandle )

Reset statistics.
Parameters
in appHandle

Generated by Doxygen

the handle returned by tlc_openSession

192

File Documentation

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

5.19.2.22

tlc_setETBTopoCount()

EXT_DECL TRDP_ERR_T tlc_setETBTopoCount (
TRDP_APP_SESSION_T appHandle,
UINT32 etbTopoCnt )

Set new topocount for trainwide communication.
This value is used for validating outgoing and incoming packets only!
Parameters
in appHandle

in

etbTopoCnt

The handle returned by tlc_openSession
New topocount value

This value is used for validating outgoing and incoming packets only!
Parameters
in appHandle

in

etbTopoCnt

the handle returned by tlc_openSession
New etbTopoCnt value

Return values
TRDP_NO_ERR
TRDP_NOINIT_ERR

5.19.2.23

no error
handle invalid

tlc_setOpTrainTopoCount()

EXT_DECL TRDP_ERR_T tlc_setOpTrainTopoCount (
TRDP_APP_SESSION_T appHandle,
UINT32 opTrnTopoCnt )

Set new operational train topocount for direction/orientation sensitive communication.
This value is used for validating outgoing and incoming packets only!
Parameters
in appHandle

in

opTrnTopoCnt

The handle returned by tlc_openSession
New operational topocount value
Generated by Doxygen

5.19 trdp_if_light.h File Reference

This value is used for validating outgoing and incoming packets only!
Parameters
in appHandle

The handle returned by tlc_openSession

opTrnTopoCnt

in

New operational topocount value

Return values
TRDP_NO_ERR
TRDP_NOINIT_ERR

5.19.2.24

no error
handle invalid

tlc_terminate()

EXT_DECL TRDP_ERR_T tlc_terminate (
void )

Un-Initialize.
Clean up and close all sessions. Mainly used for debugging/test runs. No further calls to library allowed
Return values
TRDP_NO_ERR

no error

Clean up and close all sessions. Mainly used for debugging/test runs. No further calls to library allowed
Return values
TRDP_NO_ERR

no error

TRDP_INIT_ERR

no error

TRDP_MEM_ERR
TRDP_MUTEX_ERR

5.19.2.25

TrafficStore nothing
TrafficStore mutex err

tlm_abortSession()

EXT_DECL TRDP_ERR_T tlm_abortSession (
TRDP_APP_SESSION_T appHandle,
const TRDP_UUID_T ∗ pSessionId )

Cancel an open session.
Abort an open session; any pending messages will be dropped
Parameters
in appHandle

in

p←SessionId

Generated by Doxygen

the handle returned by tlc_openSession
Session ID returned by request

193

194

File Documentation

Return values
TRDP_NO_ERR
TRDP_NO_SESSION_ERR
TRDP_NOINIT_ERR

5.19.2.26

no error
no such session
handle invalid

tlm_addListener()

EXT_DECL TRDP_ERR_T tlm_addListener (
TRDP_APP_SESSION_T appHandle,
TRDP_LIS_T ∗ pListenHandle,
const void ∗ pUserRef,
TRDP_MD_CALLBACK_T pfCbFunction,
BOOL8 comIdListener,
UINT32 comId,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
TRDP_IP_ADDR_T srcIpAddr1,
TRDP_IP_ADDR_T srcIpAddr2,
TRDP_IP_ADDR_T mcDestIpAddr,
TRDP_FLAGS_T pktFlags,
const TRDP_URI_USER_T srcURI,
const TRDP_URI_USER_T destURI )

Subscribe to MD messages.
Add a listener to TRDP to get notified when messages are received
Parameters
in
appHandle

out
in
in
in
in
in
in
in
in
in
in
in
in

the handle returned by tlc_openSession

pListenHandle

Handle for this listener returned

pUserRef

user supplied value returned with received message

pfCbFunction

Pointer to listener specific callback function, NULL to use default function

comIdListener
comId
etbTopoCnt

set TRUE if comId shall be observed
comId to be observed
ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr1

Source IP address, lower address in case of address range, set 0 if not used

srcIpAddr2

upper address in case of address range, set to 0 if not used

mcDestIpAddr

multicast group to listen on

pktFlags

OPTION: TRDP_FLAGS_DEFAULT, TRDP_FLAGS_MARSHALL, TRDP_PLAGS_TCP

srcURI

only functional group of source URI, set 0 if not used

destURI

only functional group of destination URI, set 0 if not used

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR

no error
parameter error
out of memory

Generated by Doxygen

5.19 trdp_if_light.h File Reference
Return values
TRDP_NOINIT_ERR

5.19.2.27

195

handle invalid

tlm_confirm()

EXT_DECL TRDP_ERR_T tlm_confirm (
TRDP_APP_SESSION_T appHandle,
const TRDP_UUID_T ∗ pSessionId,
UINT16 userStatus,
const TRDP_SEND_PARAM_T ∗ pSendParam )

Initiate sending MD confirm message.
Send a MD confirmation message User reference, source and destination IP addresses as well as topo counts and
packet flags are taken from the session
Parameters
in appHandle

in
in
in

the handle returned by tlc_openSession

pSessionId

Session ID returned by request

userStatus

Info for requester about application errors

pSendParam

Pointer to send parameters, NULL to use default send parameters

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NO_SESSION_ERR
TRDP_NOINIT_ERR

5.19.2.28

no error
parameter error
out of memory
no such session
handle invalid

tlm_delListener()

EXT_DECL TRDP_ERR_T tlm_delListener (
TRDP_APP_SESSION_T appHandle,
TRDP_LIS_T listenHandle )

Remove Listener.
Parameters
in
appHandle

out

listenHandle

Generated by Doxygen

the handle returned by tlc_openSession
Handle for this listener

196

File Documentation

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

parameter error

TRDP_NOINIT_ERR

handle invalid

5.19.2.29

tlm_notify()

EXT_DECL TRDP_ERR_T tlm_notify (
TRDP_APP_SESSION_T appHandle,
const void ∗ pUserRef,
TRDP_MD_CALLBACK_T pfCbFunction,
UINT32 comId,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
TRDP_IP_ADDR_T srcIpAddr,
TRDP_IP_ADDR_T destIpAddr,
TRDP_FLAGS_T pktFlags,
const TRDP_SEND_PARAM_T ∗ pSendParam,
const UINT8 ∗ pData,
UINT32 dataSize,
const TRDP_URI_USER_T sourceURI,
const TRDP_URI_USER_T destURI )

Initiate sending MD notification message.
Send a MD notification message
Parameters
in appHandle

in
in
in
in
in
in
in
in
in
in
in
in
in

the handle returned by tlc_openSession

pUserRef

user supplied value returned with reply

pfCbFunction

Pointer to listener specific callback function, NULL to use default function

comId

comId of packet to be sent

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr

own IP address, 0 - srcIP will be set by the stack

destIpAddr

where to send the packet to

pktFlags

OPTIONS: TRDP_FLAGS_DEFAULT, TRDP_FLAGS_MARSHALL, TRDP_PLAGS_TCP

pSendParam

optional pointer to send parameter, NULL - default parameters are used

pData

pointer to packet data / dataset

dataSize

size of packet data

sourceURI

only functional group of source URI

destURI

only functional group of destination URI

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR

no error
parameter error
out of memory
Generated by Doxygen

5.19 trdp_if_light.h File Reference
Return values
TRDP_NOINIT_ERR

5.19.2.30

handle invalid

tlm_readdListener()

EXT_DECL TRDP_ERR_T tlm_readdListener (
TRDP_APP_SESSION_T appHandle,
TRDP_LIS_T listenHandle,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
TRDP_IP_ADDR_T srcIpAddr,
TRDP_IP_ADDR_T srcIpAddr2,
TRDP_IP_ADDR_T mcDestIpAddr )

Resubscribe to MD messages.
Readd a listener after topoCount changes to get notified when messages are received
Parameters
in
appHandle

out
in
in
in
in
in

listenHandle
etbTopoCnt

Handle for this listener
ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr

Source IP address, lower address in case of address range, set 0 if not used

srcIpAddr2

upper address in case of address range, set 0 if not used

mcDestIpAddr

multicast group to listen on

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NOINIT_ERR

5.19.2.31

the handle returned by tlc_openSession

no error
parameter error
out of memory
handle invalid

tlm_reply()

TRDP_ERR_T tlm_reply (
TRDP_APP_SESSION_T appHandle,
const TRDP_UUID_T ∗ pSessionId,
UINT32 comId,
UINT16 userStatus,
const TRDP_SEND_PARAM_T ∗ pSendParam,
const UINT8 ∗ pData,
UINT32 dataSize )
Generated by Doxygen

197

198

File Documentation

Send a MD reply message.
Send a MD reply message after receiving an request User reference, source and destination IP addresses as well
as topo counts and packet flags are taken from the session
Parameters
in appHandle

in
in
in
in
in
in

the handle returned by tlc_openSession

pSessionId

Session ID returned by indication

comId

comId of packet to be sent

userStatus

Info for requester about application errors

pSendParam

Pointer to send parameters, NULL to use default send parameters

pData

pointer to packet data / dataset

dataSize

size of packet data

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

parameter error

TRDP_MEM_ERR

Out of memory

TRDP_NO_SESSION_ERR
TRDP_NOINIT_ERR

5.19.2.32

no error

no such session
handle invalid

tlm_replyQuery()

TRDP_ERR_T tlm_replyQuery (
TRDP_APP_SESSION_T appHandle,
const TRDP_UUID_T ∗ pSessionId,
UINT32 comId,
UINT16 userStatus,
UINT32 confirmTimeout,
const TRDP_SEND_PARAM_T ∗ pSendParam,
const UINT8 ∗ pData,
UINT32 dataSize )

Send a MD reply query message.
Send a MD reply query message after receiving a request and ask for confirmation. User reference, source and
destination IP addresses as well as topo counts and packet flags are taken from the session
Parameters
in appHandle

in
in
in
in
in
in
in

the handle returned by tlc_openSession

pSessionId

Session ID returned by indication

comId

comId of packet to be sent

userStatus

Info for requester about application errors

confirmTimeout
pSendParam

timeout for confirmation
Pointer to send parameters, NULL to use default send parameters

pData

pointer to packet data / dataset

dataSize

size of packet data
Generated by Doxygen

5.19 trdp_if_light.h File Reference

199

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NO_SESSION_ERR
TRDP_NOINIT_ERR

5.19.2.33

no error
parameter error
out of memory
no such session
handle invalid

tlm_request()

EXT_DECL TRDP_ERR_T tlm_request (
TRDP_APP_SESSION_T appHandle,
const void ∗ pUserRef,
TRDP_MD_CALLBACK_T pfCbFunction,
TRDP_UUID_T ∗ pSessionId,
UINT32 comId,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
TRDP_IP_ADDR_T srcIpAddr,
TRDP_IP_ADDR_T destIpAddr,
TRDP_FLAGS_T pktFlags,
UINT32 numReplies,
UINT32 replyTimeout,
const TRDP_SEND_PARAM_T ∗ pSendParam,
const UINT8 ∗ pData,
UINT32 dataSize,
const TRDP_URI_USER_T sourceURI,
const TRDP_URI_USER_T destURI )

Initiate sending MD request message.
Send a MD request message
Parameters
in
appHandle

in
in
out
in
in
in
in
in
in
in
in
in
in
in
in
in

the handle returned by tlc_openSession

pUserRef

user supplied value returned with reply

pfCbFunction

Pointer to listener specific callback function, NULL to use default function

pSessionId

return session ID

comId

comId of packet to be sent

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr

own IP address, 0 - srcIP will be set by the stack

destIpAddr

where to send the packet to

pktFlags

OPTIONS: TRDP_FLAGS_DEFAULT, TRDP_FLAGS_MARSHALL, TRDP_PLAGS_TCP

numReplies

number of expected replies, 0 if unknown

replyTimeout

timeout for reply

pSendParam

Pointer to send parameters, NULL to use default send parameters

pData

pointer to packet data / dataset

dataSize

size of packet data

sourceURI

only functional group of source URI

destURI

only functional group of destination URI

Generated by Doxygen

200

File Documentation

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NOINIT_ERR

5.19.2.34

no error
parameter error
out of memory
handle invalid

tlp_get()

EXT_DECL TRDP_ERR_T tlp_get (
TRDP_APP_SESSION_T appHandle,
TRDP_SUB_T subHandle,
TRDP_PD_INFO_T ∗ pPdInfo,
UINT8 ∗ pData,
UINT32 ∗ pDataSize )

Get the last valid PD message.
This allows polling of PDs instead of event driven handling by callback
Parameters

in
in
in,out
in,out
in,out

appHandle

the handle returned by tlc_openSession

subHandle

the handle returned by subscription

pPdInfo

pointer to application's info buffer

pData

pointer to application's data buffer

pDataSize

in: size of buffer, out: size of data

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_SUB_ERR
TRDP_TIMEOUT_ERR

no error
parameter error
not subscribed
packet timed out

TRDP_NOINIT_ERR

handle invalid

TRDP_COMID_ERR

ComID not found when marshalling

This allows polling of PDs instead of event driven handling by callbacks
Parameters

in
in
in,out
in,out
in,out

appHandle

the handle returned by tlc_openSession

subHandle

the handle returned by subscription

pPdInfo

pointer to application's info buffer

pData

pointer to application's data buffer

pDataSize

in: size of buffer, out: size of data

Generated by Doxygen

5.19 trdp_if_light.h File Reference
Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

parameter error

TRDP_SUB_ERR

not subscribed

TRDP_TIMEOUT_ERR

packet timed out

TRDP_NOINIT_ERR

handle invalid

TRDP_COMID_ERR

ComID not found when marshalling

5.19.2.35

tlp_getRedundant()

EXT_DECL TRDP_ERR_T tlp_getRedundant (
TRDP_APP_SESSION_T appHandle,
UINT32 redId,
BOOL8 ∗ pLeader )

Get status of redundant ComIds.
Parameters

in
in
in,out

appHandle

the handle returned by tlc_openSession

redId

will be set for all ComID's with the given redId, 0 for all redId

pLeader

TRUE if we send (leader)

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

parameter error / redId not existing

TRDP_NOINIT_ERR

handle invalid

Only the status of the first found redundancy group entry will be returned!
Parameters

in
in
in,out

appHandle

the handle returned by tlc_openSession

redId

will be returned for all ComID's with the given redId

pLeader

TRUE if we're sending this redundancy group (leader)

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

redId invalid or not existing

TRDP_NOINIT_ERR

handle invalid

Generated by Doxygen

201

202

File Documentation

5.19.2.36

tlp_publish()

EXT_DECL TRDP_ERR_T tlp_publish (
TRDP_APP_SESSION_T appHandle,
TRDP_PUB_T ∗ pPubHandle,
const void ∗ pUserRef,
TRDP_PD_CALLBACK_T pfCbFunction,
UINT32 comId,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
TRDP_IP_ADDR_T srcIpAddr,
TRDP_IP_ADDR_T destIpAddr,
UINT32 interval,
UINT32 redId,
TRDP_FLAGS_T pktFlags,
const TRDP_SEND_PARAM_T ∗ pSendParam,
const UINT8 ∗ pData,
UINT32 dataSize )

Prepare for sending PD messages.
Queue a PD message, it will be send when tlc_publish has been called
Parameters
in
appHandle

the handle returned by tlc_openSession

out
in
in
in
in
in
in
in
in
in
in

pPubHandle

returned handle for related re/unpublish

pUserRef

user supplied value returned within the info structure of callback function

pfCbFunction

Pointer to pre-send callback function, NULL if not used

comId

comId of packet to send

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr

own IP address, 0 - srcIP will be set by the stack

destIpAddr

where to send the packet to

interval

frequency of PD packet (>= 10ms) in usec

redId

0 - Non-redundant, > 0 valid redundancy group

pktFlags

OPTION: TRDP_FLAGS_DEFAULT, TRDP_FLAGS_NONE, TRDP_FLAGS_MARSHALL,
TRDP_FLAGS_CALLBACK

in
in
in

pSendParam

optional pointer to send parameter, NULL - default parameters are used

pData

pointer to data packet / dataset, NULL if sending starts later with tlp_put()

dataSize

size of data packet >= 0 and <= TRDP_MAX_PD_DATA_SIZE

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NOINIT_ERR

no error
parameter error
could not insert (out of memory)
handle invalid

Generated by Doxygen

5.19 trdp_if_light.h File Reference

5.19.2.37

tlp_put()

EXT_DECL TRDP_ERR_T tlp_put (
TRDP_APP_SESSION_T appHandle,
TRDP_PUB_T pubHandle,
const UINT8 ∗ pData,
UINT32 dataSize )

Update the process data to send.
Update previously published data. The new telegram will be sent earliest when tlc_process is called.
Parameters

in
in
in,out
in,out

appHandle

the handle returned by tlc_openSession

pubHandle

the handle returned by publish

pData

pointer to application's data buffer

dataSize

size of data

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

no error
parameter error on uninitialized parameter or changed dataSize compared to
published one

TRDP_PUB_ERR

not published

TRDP_NOINIT_ERR

handle invalid

TRDP_COMID_ERR

ComID not found when marshalling

Update previously published data. The new telegram will be sent earliest when tlc_process is called.
Parameters

in
in
in,out
in,out

appHandle

the handle returned by tlc_openSession

pubHandle

the handle returned by publish

pData

pointer to application's data buffer

dataSize

size of data

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

parameter error on uninitialized parameter or changed dataSize compared to
published one

TRDP_NOPUB_ERR

not published

TRDP_NOINIT_ERR

handle invalid

TRDP_COMID_ERR

ComID not found when marshalling

5.19.2.38

tlp_republish()

EXT_DECL TRDP_ERR_T tlp_republish (
TRDP_APP_SESSION_T appHandle,
Generated by Doxygen

203

204

File Documentation

TRDP_PUB_T pubHandle,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
TRDP_IP_ADDR_T srcIpAddr,
TRDP_IP_ADDR_T destIpAddr )

Prepare for sending PD messages.
Reinitialize and queue a PD message, it will be send when tlc_publish has been called
Parameters
in appHandle

in
in
in
in
in

pubHandle

handle for related unpublish

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr

own IP address, 0 - srcIP will be set by the stack

destIpAddr

where to send the packet to

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NOINIT_ERR

5.19.2.39

the handle returned by tlc_openSession

no error
parameter error
could not insert (out of memory)
handle invalid

tlp_request()

EXT_DECL TRDP_ERR_T tlp_request (
TRDP_APP_SESSION_T appHandle,
TRDP_SUB_T subHandle,
UINT32 comId,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
TRDP_IP_ADDR_T srcIpAddr,
TRDP_IP_ADDR_T destIpAddr,
UINT32 redId,
TRDP_FLAGS_T pktFlags,
const TRDP_SEND_PARAM_T ∗ pSendParam,
const UINT8 ∗ pData,
UINT32 dataSize,
UINT32 replyComId,
TRDP_IP_ADDR_T replyIpAddr )

Initiate sending PD messages (PULL).
Send a PD request message
Parameters
in appHandle

in

subHandle

the handle returned by tlc_openSession
handle from related subscribe
Generated by Doxygen

5.19 trdp_if_light.h File Reference
Parameters
in comId

comId of packet to be sent

in
in
in
in
in
in

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr

own IP address, 0 - srcIP will be set by the stack

destIpAddr

where to send the packet to

redId

0 - Non-redundant, > 0 valid redundancy group

pktFlags

OPTIONS: TTRDP_FLAGS_DEFAULT, TRDP_FLAGS_NONE,
TRDP_FLAGS_MARSHALL, TRDP_FLAGS_CALLBACK

in
in
in
in
in

pSendParam

optional pointer to send parameter, NULL - default parameters are used

pData

pointer to packet data / dataset

dataSize

size of packet data

replyComId

comId of reply

replyIpAddr

IP for reply

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NOINIT_ERR

205

no error
parameter error
could not insert (out of memory)
handle invalid

Send a PD request message
Parameters
in appHandle

the handle returned by tlc_openSession

in
in
in
in
in
in
in
in

subHandle
comId

handle from related subscribe
comId of packet to be sent

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr

own IP address, 0 - srcIP will be set by the stack

destIpAddr

where to send the packet to

redId

0 - Non-redundant, > 0 valid redundancy group

pktFlags

OPTION: TRDP_FLAGS_DEFAULT, TRDP_FLAGS_NONE, TRDP_FLAGS_MARSHALL,
TRDP_FLAGS_CALLBACK

in
in
in
in
in

pSendParam

optional pointer to send parameter, NULL - default parameters are used

pData

pointer to packet data / dataset

dataSize

size of packet data

replyComId

comId of reply (default comID of subscription)

replyIpAddr

IP for reply

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR

no error
parameter error
could not insert (out of memory)

TRDP_NOINIT_ERR

handle invalid

TRDP_NOSUB_ERR

no matching subscription found

Generated by Doxygen

206

File Documentation

5.19.2.40

tlp_resubscribe()

EXT_DECL TRDP_ERR_T tlp_resubscribe (
TRDP_APP_SESSION_T appHandle,
TRDP_SUB_T subHandle,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
TRDP_IP_ADDR_T srcIpAddr1,
TRDP_IP_ADDR_T srcIpAddr2,
TRDP_IP_ADDR_T destIpAddr )

Reprepare for receiving PD messages.
Resubscribe to a specific PD ComID and source IP
Parameters
in appHandle

in
in
in
in
in
in

the handle returned by tlc_openSession

subHandle

handle for this subscription

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr1

IP for source filtering, set 0 if not used

srcIpAddr2

IP for source filtering range, set 0 if not used

destIpAddr

IP address to join

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NOINIT_ERR

no error
parameter error
could not reserve memory (out of memory)
handle invalid

Resubscribe to a specific PD ComID and source IP
Parameters
in appHandle

in
in
in
in
in
in

the handle returned by tlc_openSession

subHandle

handle for this subscription

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr1

Source IP address, lower address in case of address range, set to 0 if not used

srcIpAddr2

upper address in case of address range, set to 0 if not used

destIpAddr

IP address to join

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR

no error
parameter error
could not reserve memory (out of memory)

Generated by Doxygen

5.19 trdp_if_light.h File Reference
Return values
TRDP_NOINIT_ERR
TRDP_SOCK_ERR

5.19.2.41

handle invalid
Resource (socket) not available, subscription canceled

tlp_setRedundant()

EXT_DECL TRDP_ERR_T tlp_setRedundant (
TRDP_APP_SESSION_T appHandle,
UINT32 redId,
BOOL8 leader )

Do not send redundant PD's when we are follower.
Parameters
in appHandle

in
in

the handle returned by tlc_openSession

redId

will be set for all ComID's with the given redId, 0 to change for all redId

leader

TRUE if we send

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

parameter error / redId not existing

TRDP_NOINIT_ERR

handle invalid

Do not send redundant PD's when we are follower.
Parameters
in appHandle

in
in

the handle returned by tlc_openSession

redId

will be set for all ComID's with the given redId, 0 to change for all redId

leader

TRUE if we send

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

parameter error / redId not existing

TRDP_NOINIT_ERR

handle invalid

5.19.2.42

tlp_subscribe()

EXT_DECL TRDP_ERR_T tlp_subscribe (
TRDP_APP_SESSION_T appHandle,
TRDP_SUB_T ∗ pSubHandle,
Generated by Doxygen

207

208

File Documentation

const void ∗ pUserRef,
TRDP_PD_CALLBACK_T pfCbFunction,
UINT32 comId,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
TRDP_IP_ADDR_T srcIpAddr1,
TRDP_IP_ADDR_T srcIpAddr2,
TRDP_IP_ADDR_T destIpAddr,
TRDP_FLAGS_T pktFlags,
UINT32 timeout,
TRDP_TO_BEHAVIOR_T toBehavior )

Prepare for receiving PD messages.
Subscribe to a specific PD ComID and source IP
Parameters
in
appHandle

the handle returned by tlc_openSession

out
in
in
in
in
in
in
in
in
in

pSubHandle

return a handle for this subscription

pUserRef

user supplied value returned within the info structure

pfCbFunction

Pointer to subscriber specific callback function, NULL to use default function

comId

comId of packet to receive

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr1

Source IP address, lower address in case of address range, set to 0 if not used

srcIpAddr2

upper address in case of address range, set to 0 if not used

destIpAddr

IP address to join

pktFlags

OPTION: TRDP_FLAGS_DEFAULT, TRDP_FLAGS_NONE,
TRDP_FLAGS_MARSHALL, TRDP_FLAGS_CALLBACK

in
in

timeout

timeout (>= 10ms) in usec

toBehavior

OPTION: TRDP_TO_DEFAULT, TRDP_TO_SET_TO_ZERO,
TRDP_TO_KEEP_LAST_VALUE

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NOINIT_ERR

no error
parameter error
could not reserve memory (out of memory)
handle invalid

Subscribe to a specific PD ComID and source IP.
Parameters
in
appHandle

out
in
in
in
in
in
in

the handle returned by tlc_openSession

pSubHandle

return a handle for this subscription

pUserRef

user supplied value returned within the info structure

pfCbFunction

Pointer to subscriber specific callback function, NULL to use default function

comId

comId of packet to receive

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr1

Source IP address, lower address in case of address range, set to 0 if not used
Generated by Doxygen

5.19 trdp_if_light.h File Reference
Parameters
in
srcIpAddr2

209

upper address in case of address range, set to 0 if not used

in

pktFlags

OPTION: TRDP_FLAGS_DEFAULT, TRDP_FLAGS_NONE, TRDP_FLAGS_MARSHALL,
TRDP_FLAGS_CALLBACK

in
in
in

destIpAddr

IP address to join

timeout

timeout (>= 10ms) in usec

toBehavior

timeout behavior

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NOINIT_ERR

5.19.2.43

no error
parameter error
could not reserve memory (out of memory)
handle invalid

tlp_unpublish()

EXT_DECL TRDP_ERR_T tlp_unpublish (
TRDP_APP_SESSION_T appHandle,
TRDP_PUB_T pubHandle )

Stop sending PD messages.
Parameters
in appHandle

in

pubHandle

the handle returned by tlc_openSession
the handle returned by publish

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

parameter error

TRDP_NOPUB_ERR

not published

TRDP_NOINIT_ERR

handle invalid

Parameters
in appHandle

in

pubHandle

the handle returned by tlc_openSession
the handle returned by prepare

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

parameter error

TRDP_NOPUB_ERR

not published

TRDP_NOINIT_ERR

handle invalid

Generated by Doxygen

210

File Documentation

5.19.2.44

tlp_unsubscribe()

EXT_DECL TRDP_ERR_T tlp_unsubscribe (
TRDP_APP_SESSION_T appHandle,
TRDP_SUB_T subHandle )

Stop receiving PD messages.
Unsubscribe to a specific PD ComID
Parameters
in appHandle
subHandle

in

the handle returned by tlc_openSession
the handle for this subscription

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_SUB_ERR
TRDP_NOINIT_ERR

no error
parameter error
not subscribed
handle invalid

Unsubscribe to a specific PD ComID
Parameters
in appHandle

in

subHandle

the handle returned by tlc_openSession
the handle for this subscription

Return values
TRDP_NO_ERR

no error

TRDP_PARAM_ERR

parameter error

TRDP_NOSUB_ERR

not subscribed

TRDP_NOINIT_ERR

handle invalid

5.20

trdp_mdcom.c File Reference

Functions for MD communication.

#include
#include
#include
#include


"trdp_if_light.h"
"trdp_if.h"
"trdp_utils.h"
Generated by Doxygen

5.20 trdp_mdcom.c File Reference

211

#include "trdp_mdcom.h"
Include dependency graph for trdp_mdcom.c:

trdp_mdcom.c

string.h

trdp_if.h

trdp_mdcom.h

trdp_if_light.h

trdp_private.h

trdp_utils.h

vos_utils.h

trdp_types.h

vos_mem.h

iec61375-2-3.h

stddef.h

stdio.h

vos_sock.h

vos_thread.h

vos_private.h

vos_types.h

stdint.h

Functions
• TRDP_ERR_T trdp_mdGetTCPSocket (TRDP_SESSION_PT pSession)
Initialize the specific parameters for message data Open a listening socket.

• void trdp_mdFreeSession (MD_ELE_T ∗pMDSession)
Free memory of session.

• TRDP_ERR_T trdp_mdSend (TRDP_SESSION_PT appHandle)
Sending MD messages Send the messages stored in the sendQueue Call user's callback if needed.

• void trdp_mdCheckPending (TRDP_APP_SESSION_T appHandle, TRDP_FDS_T ∗pFileDesc, INT32 ∗p←NoDesc)
Check for pending packets, set FD if non blocking.

• void trdp_mdCheckListenSocks (const TRDP_SESSION_PT appHandle, TRDP_FDS_T ∗pRfds, INT32 ∗p←Count)
Checking receive connection requests and data Call user's callback if needed.

• void trdp_mdCheckTimeouts (TRDP_SESSION_PT appHandle)
Checking message data timeouts Call user's callback if needed.

• TRDP_ERR_T trdp_mdReply (const TRDP_MSG_T msgType, TRDP_APP_SESSION_T appHandle, TRD←P_UUID_T pSessionId, UINT32 comId, UINT32 timeout, INT32 replyStatus, const TRDP_SEND_PARAM_T
∗pSendParam, const UINT8 ∗pData, UINT32 dataSize)
Send a MD reply/reply query message.

• TRDP_ERR_T trdp_mdCall (const TRDP_MSG_T msgType, TRDP_APP_SESSION_T appHandle, const
void ∗pUserRef, TRDP_MD_CALLBACK_T pfCbFunction, TRDP_UUID_T ∗pSessionId, UINT32 comId, U←INT32 etbTopoCnt, UINT32 opTrnTopoCnt, TRDP_IP_ADDR_T srcIpAddr, TRDP_IP_ADDR_T destIpAddr,
TRDP_FLAGS_T pktFlags, UINT32 numExpReplies, UINT32 replyTimeout, INT32 replyStatus, const TR←DP_SEND_PARAM_T ∗pSendParam, const UINT8 ∗pData, UINT32 dataSize, const TRDP_URI_USER_T
srcURI, const TRDP_URI_USER_T destURI)
Generated by Doxygen

212

File Documentation

Initiate sending MD request message - private SW level Send a MD request message.

• TRDP_ERR_T trdp_mdConfirm (TRDP_APP_SESSION_T appHandle, const TRDP_UUID_T ∗pSessionId,
UINT16 userStatus, const TRDP_SEND_PARAM_T ∗pSendParam)
Initiate sending MD confirm message - private SW level Send a MD confirmation message User reference, source
and destination IP addresses as well as topo counts and packet flags are taken from the session.

5.20.1

Detailed Description

Functions for MD communication.
Note
Project: TCNOpen TRDP prototype stack

Author
Simone Pachera, FARsystems Gari Oiarbide, CAF Michael Koch, Bombardier Transportations Bernd Loehr,
NewTec

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.
Id
trdp_mdcom.c 1779 2018-11-07 09:49:55Z bloehr
BL
BL
BL
BL
SB
BL
BL
BL
BL
BL
BL
BL
AHW
BL
BL
AHW
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL

2018-11-07:
2018-11-07:
2018-11-06:
2018-06-27:
2018-10-29:
2018-06-27:
2018-06-20:
2018-05-14:
2018-01-29:
2017-11-28:
2017-11-15:
2017-11-09:
2017-11-08:
2017-06-28:
2017-05-22:
2017-05-22:
2017-05-08:
2017-03-01:
2017-02-27:
2017-02-10:
2017-02-10:
2016-07-09:
2016-07-06:
2016-03-10:
2016-02-04:
2015-12-22:
2015-08-31:
2014-08-28:

Ticket #185 MD reply: Infinite timeout wrong handled
Ticket #220 Message Data - Different behaviour UDP & TCP
for-loops limited to sCurrentMaxSocketCnt instead VOS_MAX_SOCKET_CNT
Ticket #206 Message data transmission fails for several test cases (revisited, size handling r
Ticket #216: Message data size and padding wrong if marshalling is used
Ticket #206 Message data transmission fails for several test cases
Ticket #184: Building with VS 2015: WIN64 and Windows threads (SOCKET instead of INT32)
Ticket #200 Notify ’sender element’ fields, set twice
Ticket #188 Typo in the TRDP_VAR_SIZE definition
Ticket #180 Filtering rules for DestinationURI does not follow the standard
Ticket #1
Unjoin on unsubscribe/delListener (finally ;-)
Ticket #174: Receiving fragmented TCP packets
Ticket #179 Max. number of retries (part of sendParam) of a MD request needs to be checked
Ticket #160: Receiving fragmented TCP packets
Ticket #122: Addendum for 64Bit compatibility (VOS_TIME_T -> VOS_TIMEVAL_T)
Ticket #158 Infinit timeout at TRDB level is 0 acc. standard
Compiler warnings, doxygen comment errors
Ticket #149 SourceUri and DestinationUri don’t with 32 characters
Ticket #148 Wrong element used in trdp_mdCheckTimeouts() to invoke the callback
Ticket #138 Erroneous closing of receive md socket
Ticket #142 Compiler warnings / MISRA-C 2012 issues
Ticket #127 MD notify message: Invalid session identifier
Ticket #122 64Bit compatibility (+ compiler warnings)
Ticket #115 MD: Missing parameter pktFlags in tlm_reply() and tlm_replyQuery()
Ticket #110: Handling of optional marshalling on sending
Mutex removed
Ticket #94: TRDP_REDUNDANT flag is evaluated, beQuiet removed
Ticket #62: Failing TCP communication fixed,
Do not read if there’s nothing to read (’Mc’ has no data!)
BL 2014-08-25: Ticket #57+58: Padding / zero bytes trailing MD & PD packets fixed
BL 2014-07-14: Ticket #46: Protocol change: operational topocount needed
Ticket #47: Protocol change: no FCS for data part of telegrams
BL 2014-02-28: Ticket #25: CRC32 calculation is not according to IEEE802.3
Generated by Doxygen

5.20 trdp_mdcom.c File Reference

5.20.2

Function Documentation

5.20.2.1

trdp_mdCall()

TRDP_ERR_T trdp_mdCall (
const TRDP_MSG_T msgType,
TRDP_APP_SESSION_T appHandle,
const void ∗ pUserRef,
TRDP_MD_CALLBACK_T pfCbFunction,
TRDP_UUID_T ∗ pSessionId,
UINT32 comId,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
TRDP_IP_ADDR_T srcIpAddr,
TRDP_IP_ADDR_T destIpAddr,
TRDP_FLAGS_T pktFlags,
UINT32 numExpReplies,
UINT32 replyTimeout,
INT32 replyStatus,
const TRDP_SEND_PARAM_T ∗ pSendParam,
const UINT8 ∗ pData,
UINT32 dataSize,
const TRDP_URI_USER_T srcURI,
const TRDP_URI_USER_T destURI )

Initiate sending MD request message - private SW level Send a MD request message.
Parameters
in
msgType

TRDP_MSG_MN or TRDP_MSG_MR

in
in
in
out
in
in
in
in
in
in

appHandle

the handle returned by tlc_init

pUserRef

user supplied value returned with reply

pfCbFunction

Pointer to listener specific callback function, NULL to use default function

pSessionId

return session ID

comId

comId of packet to be sent

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr

own IP address, 0 - srcIP will be set by the stack

destIpAddr

where to send the packet to

pktFlags

OPTION: TRDP_FLAGS_DEFAULT, TRDP_FLAGS_NONE,
TRDP_FLAGS_MARSHALL

in
in
in
in
in
in
in
in

numExpReplies

number of expected replies, 0 if unknown

replyTimeout

timeout for reply

replyStatus

status to be returned

pSendParam

Pointer to send parameters, NULL to use default send parameters

pData

pointer to packet data / dataset

dataSize

size of packet data

srcURI

only functional group of source URI

destURI

only functional group of destination URI

Generated by Doxygen

213

214

File Documentation

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR

5.20.2.2

no error
parameter error
out of memory

trdp_mdCheckListenSocks()

void trdp_mdCheckListenSocks (
const TRDP_SESSION_PT appHandle,
TRDP_FDS_T ∗ pRfds,
INT32 ∗ pCount )

Checking receive connection requests and data Call user's callback if needed.
Parameters

in
in
in,out

5.20.2.3

appHandle

session pointer

pRfds

pointer to set of ready descriptors

pCount

pointer to number of ready descriptors

trdp_mdCheckPending()

void trdp_mdCheckPending (
TRDP_APP_SESSION_T appHandle,
TRDP_FDS_T ∗ pFileDesc,
INT32 ∗ pNoDesc )

Check for pending packets, set FD if non blocking.
Parameters

in
in,out
in,out

5.20.2.4

appHandle

session pointer

pFileDesc

pointer to set of ready descriptors

pNoDesc

pointer to number of ready descriptors

trdp_mdCheckTimeouts()

void trdp_mdCheckTimeouts (
TRDP_SESSION_PT appHandle )

Checking message data timeouts Call user's callback if needed.

Generated by Doxygen

5.20 trdp_mdcom.c File Reference
Parameters
in appHandle

5.20.2.5

215

session pointer

trdp_mdConfirm()

TRDP_ERR_T trdp_mdConfirm (
TRDP_APP_SESSION_T appHandle,
const TRDP_UUID_T ∗ pSessionId,
UINT16 userStatus,
const TRDP_SEND_PARAM_T ∗ pSendParam )

Initiate sending MD confirm message - private SW level Send a MD confirmation message User reference, source
and destination IP addresses as well as topo counts and packet flags are taken from the session.
Parameters
in appHandle

in
in
in

the handle returned by tlc_init

pSessionId

Session ID returned by request

userStatus

Info for requester about application errors

pSendParam

Pointer to send parameters, NULL to use default send parameters

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NOSESSION_ERR

5.20.2.6

no error
parameter error
out of memory
no such session

trdp_mdFreeSession()

void trdp_mdFreeSession (
MD_ELE_T ∗ pMDSession )

Free memory of session.
Parameters
in pMDSession

Generated by Doxygen

session pointer

216

File Documentation

Here is the call graph for this function:

trdp_mdFreeSession

5.20.2.7

vos_memFree

trdp_mdGetTCPSocket()

TRDP_ERR_T trdp_mdGetTCPSocket (
TRDP_SESSION_PT pSession )

Initialize the specific parameters for message data Open a listening socket.
Parameters
in pSession

session parameters

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

5.20.2.8

no error
initialization error

trdp_mdReply()

TRDP_ERR_T trdp_mdReply (
const TRDP_MSG_T msgType,
TRDP_APP_SESSION_T appHandle,
TRDP_UUID_T pSessionId,
UINT32 comId,
UINT32 timeout,
INT32 replyStatus,
const TRDP_SEND_PARAM_T ∗ pSendParam,
const UINT8 ∗ pData,
UINT32 dataSize )

Send a MD reply/reply query message.
Send either a MD reply message or a MD reply query message after receiving a request and ask for confirmation.
User reference, source and destination IP addresses as well as topo counts and packet flags are taken from the
session

Generated by Doxygen

5.21 trdp_mdcom.h File Reference
Parameters
in msgType

in
in
in
in
in
in
in
in

TRDP_MSG_MP or TRDP_MSG_MQ

appHandle

the handle returned by tlc_init

pSessionId

Session ID returned by indication

comId

comId of packet to be sent

timeout

time out for confirmations (zero for TRDP_MSG_MP)

replyStatus

Info for requester about application errors

pSendParam

Pointer to send parameters, NULL to use default send parameters

pData

pointer to packet data / dataset

dataSize

size of packet data

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NO_SESSION_ERR

5.20.2.9

no error
parameter error
out of memory
no such session

trdp_mdSend()

TRDP_ERR_T trdp_mdSend (
TRDP_SESSION_PT appHandle )

Sending MD messages Send the messages stored in the sendQueue Call user's callback if needed.
Parameters
in appHandle

5.21

session pointer

trdp_mdcom.h File Reference

Functions for MD communication.
Generated by Doxygen

217

218

File Documentation

#include "trdp_private.h"
Include dependency graph for trdp_mdcom.h:

trdp_mdcom.h

trdp_private.h

trdp_types.h

iec61375-2-3.h

vos_mem.h

vos_sock.h

vos_thread.h

vos_private.h

vos_types.h

stdint.h

This graph shows which files directly or indirectly include this file:

trdp_mdcom.h

trdp_mdcom.c

Functions
• TRDP_ERR_T trdp_mdGetTCPSocket (TRDP_SESSION_PT pSession)
Generated by Doxygen

5.21 trdp_mdcom.h File Reference

219

Initialize the specific parameters for message data Open a listening socket.

• void trdp_mdFreeSession (MD_ELE_T ∗pMDSession)
Free memory of session.

• TRDP_ERR_T trdp_mdSend (TRDP_SESSION_PT appHandle)
Sending MD messages Send the messages stored in the sendQueue Call user's callback if needed.

• void trdp_mdCheckPending (TRDP_APP_SESSION_T appHandle, TRDP_FDS_T ∗pFileDesc, INT32 ∗p←NoDesc)
Check for pending packets, set FD if non blocking.

• void trdp_mdCheckListenSocks (const TRDP_SESSION_PT appHandle, TRDP_FDS_T ∗pRfds, INT32 ∗p←Count)
Checking receive connection requests and data Call user's callback if needed.

• void trdp_mdCheckTimeouts (TRDP_SESSION_PT appHandle)
Checking message data timeouts Call user's callback if needed.

• TRDP_ERR_T trdp_mdConfirm (TRDP_APP_SESSION_T appHandle, const TRDP_UUID_T ∗pSessionId,
UINT16 userStatus, const TRDP_SEND_PARAM_T ∗pSendParam)
Initiate sending MD confirm message - private SW level Send a MD confirmation message User reference, source
and destination IP addresses as well as topo counts and packet flags are taken from the session.

• TRDP_ERR_T trdp_mdReply (const TRDP_MSG_T msgType, TRDP_APP_SESSION_T appHandle, TRD←P_UUID_T pSessionId, UINT32 comId, UINT32 timeout, INT32 replyStatus, const TRDP_SEND_PARAM_T
∗pSendParam, const UINT8 ∗pData, UINT32 dataSize)
Send a MD reply/reply query message.

• TRDP_ERR_T trdp_mdCall (const TRDP_MSG_T msgType, TRDP_APP_SESSION_T appHandle, const
void ∗pUserRef, TRDP_MD_CALLBACK_T pfCbFunction, TRDP_UUID_T ∗pSessionId, UINT32 comId, U←INT32 etbTopoCnt, UINT32 opTrnTopoCnt, TRDP_IP_ADDR_T srcIpAddr, TRDP_IP_ADDR_T destIpAddr,
TRDP_FLAGS_T pktFlags, UINT32 numExpReplies, UINT32 replyTimeout, INT32 replyStatus, const TR←DP_SEND_PARAM_T ∗pSendParam, const UINT8 ∗pData, UINT32 dataSize, const TRDP_URI_USER_T
srcURI, const TRDP_URI_USER_T destURI)
Initiate sending MD request message - private SW level Send a MD request message.

5.21.1

Detailed Description

Functions for MD communication.
Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.
Id
trdp_mdcom.h 1681 2017-11-09 10:37:16Z ahweiss
AHW 2017-11-08: Ticket #179 Max. number of retries (part of sendParam) of a MD request needs to be checked
BL 2014-07-14: Ticket #46: Protocol change: operational topocount needed
Ticket #47: Protocol change: no FCS for data part of telegrams
Generated by Doxygen

220

File Documentation

5.21.2

Function Documentation

5.21.2.1

trdp_mdCall()

TRDP_ERR_T trdp_mdCall (
const TRDP_MSG_T msgType,
TRDP_APP_SESSION_T appHandle,
const void ∗ pUserRef,
TRDP_MD_CALLBACK_T pfCbFunction,
TRDP_UUID_T ∗ pSessionId,
UINT32 comId,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
TRDP_IP_ADDR_T srcIpAddr,
TRDP_IP_ADDR_T destIpAddr,
TRDP_FLAGS_T pktFlags,
UINT32 numExpReplies,
UINT32 replyTimeout,
INT32 replyStatus,
const TRDP_SEND_PARAM_T ∗ pSendParam,
const UINT8 ∗ pData,
UINT32 dataSize,
const TRDP_URI_USER_T srcURI,
const TRDP_URI_USER_T destURI )

Initiate sending MD request message - private SW level Send a MD request message.
Parameters
in
msgType

TRDP_MSG_MN or TRDP_MSG_MR

in
in
in
out
in
in
in
in
in
in

appHandle

the handle returned by tlc_init

pUserRef

user supplied value returned with reply

pfCbFunction

Pointer to listener specific callback function, NULL to use default function

pSessionId

return session ID

comId

comId of packet to be sent

etbTopoCnt

ETB topocount to use, 0 if consist local communication

opTrnTopoCnt

operational topocount, != 0 for orientation/direction sensitive communication

srcIpAddr

own IP address, 0 - srcIP will be set by the stack

destIpAddr

where to send the packet to

pktFlags

OPTION: TRDP_FLAGS_DEFAULT, TRDP_FLAGS_NONE,
TRDP_FLAGS_MARSHALL

in
in
in
in
in
in
in
in

numExpReplies

number of expected replies, 0 if unknown

replyTimeout

timeout for reply

replyStatus

status to be returned

pSendParam

Pointer to send parameters, NULL to use default send parameters

pData

pointer to packet data / dataset

dataSize

size of packet data

srcURI

only functional group of source URI

destURI

only functional group of destination URI

Generated by Doxygen

5.21 trdp_mdcom.h File Reference
Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR

5.21.2.2

no error
parameter error
out of memory

trdp_mdCheckListenSocks()

void trdp_mdCheckListenSocks (
const TRDP_SESSION_PT appHandle,
TRDP_FDS_T ∗ pRfds,
INT32 ∗ pCount )

Checking receive connection requests and data Call user's callback if needed.
Parameters

in
in
in,out

5.21.2.3

appHandle

session pointer

pRfds

pointer to set of ready descriptors

pCount

pointer to number of ready descriptors

trdp_mdCheckPending()

void trdp_mdCheckPending (
TRDP_APP_SESSION_T appHandle,
TRDP_FDS_T ∗ pFileDesc,
INT32 ∗ pNoDesc )

Check for pending packets, set FD if non blocking.
Parameters

in
in,out
in,out

5.21.2.4

appHandle

session pointer

pFileDesc

pointer to set of ready descriptors

pNoDesc

pointer to number of ready descriptors

trdp_mdCheckTimeouts()

void trdp_mdCheckTimeouts (
TRDP_SESSION_PT appHandle )

Checking message data timeouts Call user's callback if needed.

Generated by Doxygen

221

222

File Documentation

Parameters
in appHandle

5.21.2.5

session pointer

trdp_mdConfirm()

TRDP_ERR_T trdp_mdConfirm (
TRDP_APP_SESSION_T appHandle,
const TRDP_UUID_T ∗ pSessionId,
UINT16 userStatus,
const TRDP_SEND_PARAM_T ∗ pSendParam )

Initiate sending MD confirm message - private SW level Send a MD confirmation message User reference, source
and destination IP addresses as well as topo counts and packet flags are taken from the session.
Parameters
in appHandle

in
in
in

the handle returned by tlc_init

pSessionId

Session ID returned by request

userStatus

Info for requester about application errors

pSendParam

Pointer to send parameters, NULL to use default send parameters

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NOSESSION_ERR

5.21.2.6

no error
parameter error
out of memory
no such session

trdp_mdFreeSession()

void trdp_mdFreeSession (
MD_ELE_T ∗ pMDSession )

Free memory of session.
Parameters
in pMDSession

session pointer

Generated by Doxygen

5.21 trdp_mdcom.h File Reference

223

Here is the call graph for this function:

trdp_mdFreeSession

5.21.2.7

vos_memFree

trdp_mdGetTCPSocket()

TRDP_ERR_T trdp_mdGetTCPSocket (
TRDP_SESSION_PT pSession )

Initialize the specific parameters for message data Open a listening socket.
Parameters
in pSession

session parameters

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

5.21.2.8

no error
initialization error

trdp_mdReply()

TRDP_ERR_T trdp_mdReply (
const TRDP_MSG_T msgType,
TRDP_APP_SESSION_T appHandle,
TRDP_UUID_T pSessionId,
UINT32 comId,
UINT32 timeout,
INT32 replyStatus,
const TRDP_SEND_PARAM_T ∗ pSendParam,
const UINT8 ∗ pData,
UINT32 dataSize )

Send a MD reply/reply query message.
Send either a MD reply message or a MD reply query message after receiving a request and ask for confirmation.
User reference, source and destination IP addresses as well as topo counts and packet flags are taken from the
session

Generated by Doxygen

224

File Documentation

Parameters
in msgType

in
in
in
in
in
in
in
in

TRDP_MSG_MP or TRDP_MSG_MQ

appHandle

the handle returned by tlc_init

pSessionId

Session ID returned by indication

comId

comId of packet to be sent

timeout

time out for confirmations (zero for TRDP_MSG_MP)

replyStatus

Info for requester about application errors

pSendParam

Pointer to send parameters, NULL to use default send parameters

pData

pointer to packet data / dataset

dataSize

size of packet data

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_MEM_ERR
TRDP_NO_SESSION_ERR

5.21.2.9

no error
parameter error
out of memory
no such session

trdp_mdSend()

TRDP_ERR_T trdp_mdSend (
TRDP_SESSION_PT appHandle )

Sending MD messages Send the messages stored in the sendQueue Call user's callback if needed.
Parameters
in appHandle

5.22

session pointer

trdp_pdcom.c File Reference

Functions for PD communication.

#include
#include
#include
#include
#include
#include
#include
#include


"trdp_types.h"
"trdp_utils.h"
"trdp_pdcom.h"
"trdp_if.h"
"trdp_stats.h"
"vos_sock.h"
"vos_mem.h"
Generated by Doxygen

5.22 trdp_pdcom.c File Reference

225

Include dependency graph for trdp_pdcom.c:

trdp_pdcom.c

string.h

trdp_if.h

trdp_pdcom.h

trdp_if_light.h

trdp_stats.h

trdp_private.h

trdp_types.h

vos_mem.h

trdp_utils.h

vos_utils.h

stddef.h

iec61375-2-3.h

stdio.h

vos_sock.h

vos_thread.h

vos_private.h

vos_types.h

stdint.h

Functions
• void trdp_pdInit (PD_ELE_T ∗pPacket, TRDP_MSG_T type, UINT32 etbTopoCnt, UINT32 opTrnTopoCnt,
UINT32 replyComId, UINT32 replyIpAddress)
Initialize/construct the packet Set the header infos.

• TRDP_ERR_T trdp_pdPut (PD_ELE_T ∗pPacket, TRDP_MARSHALL_T marshall, void ∗refCon, const UI←NT8 ∗pData, UINT32 dataSize)
Copy data Update the data to be sent.

• TRDP_ERR_T trdp_pdGet (PD_ELE_T ∗pPacket, TRDP_UNMARSHALL_T unmarshall, void ∗refCon, const
UINT8 ∗pData, UINT32 ∗pDataSize)
Copy data Set the header infos.

• TRDP_ERR_T trdp_pdSendQueued (TRDP_SESSION_PT appHandle)
Send all due PD messages.

• TRDP_ERR_T trdp_pdReceive (TRDP_SESSION_PT appHandle, SOCKET sock)
Receiving PD messages Read the receive socket for arriving PDs, copy the packet to a new PD_ELE_T Check for
protocol errors and compare the received data to the data in our receive queue.

• void trdp_pdCheckPending (TRDP_APP_SESSION_T appHandle, TRDP_FDS_T ∗pFileDesc, INT32 ∗p←NoDesc)
Check for pending packets, set FD if non blocking.

• void trdp_pdHandleTimeOuts (TRDP_SESSION_PT appHandle)
Check for time outs.

• TRDP_ERR_T trdp_pdCheckListenSocks (TRDP_SESSION_PT appHandle, TRDP_FDS_T ∗pRfds, INT32
∗pCount)
Checking receive connection requests and data Call user's callback if needed.

• void trdp_pdUpdate (PD_ELE_T ∗pPacket)
Update the header values.

Generated by Doxygen

226

File Documentation
• TRDP_ERR_T trdp_pdCheck (PD_HEADER_T ∗pPacket, UINT32 packetSize)
Check if the PD header values and the CRCs are sane.

• TRDP_ERR_T trdp_pdSend (SOCKET pdSock, PD_ELE_T ∗pPacket, UINT16 port)
Send one PD packet.

• TRDP_ERR_T trdp_pdDistribute (PD_ELE_T ∗pSndQueue)
Distribute send time of PD packets over time.

5.22.1

Detailed Description

Functions for PD communication.
Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH
Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2015. All rights reserved.
Id
trdp_pdcom.c 1772 2018-10-30 12:18:12Z bloehr
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
IBO
BL
BL
BL
BL
BL
AHW
AHW
BL

2018-10-29:
2018-08-07:
2018-06-20:
2018-01-29:
2017-11-28:
2017-11-15:
2017-11-10:
2017-07-24:
2017-03-01:
2017-02-27:
2017-02-10:
2017-02-08:
2017-02-08:
2016-06-24:
2016-06-08:
2016-06-01:
2016-03-04:
2016-02-03:
2016-01-25:
2015-12-14:
2015-11-24:
2015-08-31:
2015-08-05:
2015-04-10:
2015-04-10:
2014-07-14:

BL 2014-06-02:
BL
BL
BL
BL
BL
BL

2014-02-28:
2014-02-27:
2014-01-09:
2013-06-24:
2013-04-09:
2013-01-25:

Ticket #217 PD Pull requests must be subscribed for
Ticket #207 tlp_put() and variable dataSize
Ticket #184: Building with VS 2015: WIN64 and Windows threads (SOCKET instead of INT32)
Ticket #186 Potential SEGFAULT in case of PD timeout
Ticket #180 Filtering rules for DestinationURI does not follow the standard
Ticket #1
Unjoin on unsubscribe/delListener (finally ;-)
Ticket #172 Infinite loop of message sending after PD Pull Request when registered in multicas
Ticket #166 Bug in trdp_pdReceive for "if data has changed"
Ticket #136 PD topography counter with faulty behavior
Ticket #146 On Timeout, PD Callback is always called with no data/datasize == 0
Ticket #132: tlp_publish: Check of datasize wrong if using marshaller
Ticket #142: Compiler warnings / MISRA-C 2012 issues
Ticket #133: Accelerate PD packet reception
Ticket #121: Callback on first packet after time out
Ticket #120: ComIds for statistics changed to proposed 61375 errata
Ticket #119: tlc_getInterval() repeatedly returns 0 after timeout
Ticket #112: Marshalling sets wrong datasetLength (PD)
Ticket #109: vos_ntohs -> vos_ntohl for datasetlength when unmarshalling
Ticket #106: User needs to be informed on every received PD packet
Ticket #33: source size check for marshalling
Ticket #104: PD telegrams with no data is never sent
Ticket #94: TRDP_REDUNDANT flag is evaluated, beQuiet removed
Ticket #81: Counts for packet loss
Ticket #76: Wrong initialisation of frame pointer in trdp_pdReceive()
Ticket #79: handling for dataSize==0/pData== NULL fixed in in trdp_pdPut()
Ticket #46: Protocol change: operational topocount needed
Ticket #47: Protocol change: no FCS for data part of telegrams
Ticket #43: Usage of memset() in the trdp_pdReceive() function
Ticket #41: Sequence counter handling fixed
Ticket #42: memcmp only if callback enabled
Ticket #25: CRC32 calculation is not according IEEE802.3
Ticket #23: tlc_getInterval() always returning 10ms
Ticket #14: Wrong error return in trdp_pdDistribute()
ID 125: Time-out handling and ready descriptors fixed
ID 92: Pull request led to reset of push message type
ID 20: Redundancy handling fixed
Generated by Doxygen

5.22 trdp_pdcom.c File Reference

5.22.2

Function Documentation

5.22.2.1

trdp_pdCheck()

227

TRDP_ERR_T trdp_pdCheck (
PD_HEADER_T ∗ pPacket,
UINT32 packetSize )

Check if the PD header values and the CRCs are sane.
Parameters
in pPacket

in

packetSize

pointer to the packet to check
max size to check

Return values
TRDP_NO_ERR
TRDP_CRC_ERR

5.22.2.2

trdp_pdCheckListenSocks()

TRDP_ERR_T trdp_pdCheckListenSocks (
TRDP_SESSION_PT appHandle,
TRDP_FDS_T ∗ pRfds,
INT32 ∗ pCount )

Checking receive connection requests and data Call user's callback if needed.
Parameters

in
in
in,out

appHandle

session pointer

pRfds

pointer to set of ready descriptors

pCount

pointer to number of ready descriptors

Here is the call graph for this function:

trdp_pdCheckListenSocks

Generated by Doxygen

trdp_pdReceive

228

5.22.2.3

File Documentation

trdp_pdCheckPending()

void trdp_pdCheckPending (
TRDP_APP_SESSION_T appHandle,
TRDP_FDS_T ∗ pFileDesc,
INT32 ∗ pNoDesc )

Check for pending packets, set FD if non blocking.
Parameters

in
in,out
in,out

5.22.2.4

appHandle

session pointer

pFileDesc

pointer to set of ready descriptors

pNoDesc

pointer to number of ready descriptors

trdp_pdDistribute()

TRDP_ERR_T trdp_pdDistribute (
PD_ELE_T ∗ pSndQueue )

Distribute send time of PD packets over time.
The duration of PD packets on a 100MBit/s network ranges from 3us to 150us max. Because a cyclic thread
scheduling below 5ms would put a too heavy load on the system, and PD packets cannot get larger than 1432 (+
UDP header), we will not account for differences in packet size. Another factor is the differences in intervals for
different packets: We should only change the starting times of the packets within 1/2 the interval time. Otherwise a
late addition of packets could lead to timeouts of already queued packets. Scheduling will be computed based on
the smallest interval time.
Parameters
in pSndQueue

pointer to send queue

Return values
TRDP_NO_ERR

Generated by Doxygen

5.22 trdp_pdcom.c File Reference

229

Here is the call graph for this function:

vos_cmpTime

vos_divTime
trdp_pdDistribute
vos_mulTime

vos_addTime

5.22.2.5

trdp_pdHandleTimeOuts()

void trdp_pdHandleTimeOuts (
TRDP_SESSION_PT appHandle )

Check for time outs.
Parameters
in appHandle

application handle

Here is the call graph for this function:

trdp_pdHandleTimeOuts

5.22.2.6

trdp_pdInit()

void trdp_pdInit (
PD_ELE_T ∗ pPacket,
Generated by Doxygen

vos_getTime

230

File Documentation

TRDP_MSG_T type,
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
UINT32 replyComId,
UINT32 replyIpAddress )

Initialize/construct the packet Set the header infos.
Parameters
in pPacket

in
in
in
in
in

pointer to the packet element to init

type

type the packet

etbTopoCnt

topocount to use for PD frame

opTrnTopoCnt

topocount to use for PD frame

replyComId

Pull request comId

replyIpAddress

Pull request Ip

Here is the call graph for this function:

vos_htons
trdp_pdInit
vos_htonl

5.22.2.7

trdp_pdPut()

TRDP_ERR_T trdp_pdPut (
PD_ELE_T ∗ pPacket,
TRDP_MARSHALL_T marshall,
void ∗ refCon,
const UINT8 ∗ pData,
UINT32 dataSize )

Copy data Update the data to be sent.
Parameters
in pPacket

in
in
in
in

pointer to the packet element to send

marshall

pointer to marshalling function

refCon

reference for marshalling function

pData

pointer to data

dataSize

size of data

Generated by Doxygen

5.22 trdp_pdcom.c File Reference
Return values
TRDP_NO_ERR

5.22.2.8

231

no error other errors

trdp_pdReceive()

TRDP_ERR_T trdp_pdReceive (
TRDP_SESSION_PT appHandle,
SOCKET sock )

Receiving PD messages Read the receive socket for arriving PDs, copy the packet to a new PD_ELE_T Check for
protocol errors and compare the received data to the data in our receive queue.
If it is a new packet, check if it is a PD Request (PULL). If it is an update, exchange the existing entry with the new
one Call user's callback if needed
Parameters
in appHandle

in

session pointer

sock

the socket to read from

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_WIRE_ERR
TRDP_QUEUE_ERR
TRDP_CRC_ERR
TRDP_TOPOCOUNT_ERR

5.22.2.9

no error
parameter error
protocol error (late packet, version mismatch)
not in queue
header checksum
invalid topocount

trdp_pdSend()

TRDP_ERR_T trdp_pdSend (
SOCKET pdSock,
PD_ELE_T ∗ pPacket,
UINT16 port )

Send one PD packet.
Parameters
in pdSock

in
in

socket descriptor

pPacket

pointer to packet to be sent

port

port on which to send

Generated by Doxygen

232

File Documentation

Return values
TRDP_NO_ERR
TRDP_IO_ERR

5.22.2.10

trdp_pdSendQueued()

TRDP_ERR_T trdp_pdSendQueued (
TRDP_SESSION_PT appHandle )

Send all due PD messages.
Parameters
in appHandle

session pointer

Return values
TRDP_NO_ERR

no error

TRDP_IO_ERR

socket I/O error

Here is the call graph for this function:

vos_clearTime
trdp_pdSendQueued
vos_getTime

5.22.2.11

trdp_pdUpdate()

void trdp_pdUpdate (
PD_ELE_T ∗ pPacket )

Update the header values.
Parameters
in pPacket

pointer to the packet to update

Generated by Doxygen

5.23 trdp_pdcom.h File Reference

233

Here is the call graph for this function:

vos_htons

trdp_pdUpdate

vos_htonl

vos_crc32

5.23

trdp_pdcom.h File Reference

Functions for PD communication.

#include "trdp_private.h"
Include dependency graph for trdp_pdcom.h:

trdp_pdcom.h

trdp_private.h

trdp_types.h

iec61375-2-3.h

vos_mem.h

vos_sock.h

vos_thread.h

vos_private.h

vos_types.h

stdint.h

Generated by Doxygen

234

File Documentation

This graph shows which files directly or indirectly include this file:

trdp_pdcom.h

trdp_if.c

trdp_pdcom.c

trdp_stats.c

Functions
• void trdp_pdInit (PD_ELE_T ∗, TRDP_MSG_T, UINT32 topoCount, UINT32 optopoCount, UINT32 reply←ComId, UINT32 replyIpAddress)
Initialize/construct the packet Set the header infos.

• void trdp_pdUpdate (PD_ELE_T ∗)
Update the header values.

• TRDP_ERR_T trdp_pdPut (PD_ELE_T ∗, TRDP_MARSHALL_T func, void ∗refCon, const UINT8 ∗pData,
UINT32 dataSize)
Copy data Update the data to be sent.

• TRDP_ERR_T trdp_pdCheck (PD_HEADER_T ∗pPacket, UINT32 packetSize)
Check if the PD header values and the CRCs are sane.

• TRDP_ERR_T trdp_pdSend (SOCKET pdSock, PD_ELE_T ∗pPacket, UINT16 port)
Send one PD packet.

• TRDP_ERR_T trdp_pdGet (PD_ELE_T ∗pPacket, TRDP_UNMARSHALL_T unmarshall, void ∗refCon, const
UINT8 ∗pData, UINT32 ∗pDataSize)
Copy data Set the header infos.

• TRDP_ERR_T trdp_pdSendQueued (TRDP_SESSION_PT appHandle)
Send all due PD messages.

• TRDP_ERR_T trdp_pdReceive (TRDP_SESSION_PT pSessionHandle, SOCKET sock)
Receiving PD messages Read the receive socket for arriving PDs, copy the packet to a new PD_ELE_T Check for
protocol errors and compare the received data to the data in our receive queue.

• void trdp_pdCheckPending (TRDP_APP_SESSION_T appHandle, TRDP_FDS_T ∗pFileDesc, INT32 ∗p←NoDesc)
Check for pending packets, set FD if non blocking.

• void trdp_pdHandleTimeOuts (TRDP_SESSION_PT appHandle)
Check for time outs.

• TRDP_ERR_T trdp_pdCheckListenSocks (TRDP_SESSION_PT appHandle, TRDP_FDS_T ∗pRfds, INT32
∗pCount)
Checking receive connection requests and data Call user's callback if needed.

• TRDP_ERR_T trdp_pdDistribute (PD_ELE_T ∗pSndQueue)
Distribute send time of PD packets over time.
Generated by Doxygen

5.23 trdp_pdcom.h File Reference

5.23.1

235

Detailed Description

Functions for PD communication.
Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.

Id
trdp_pdcom.h 1740 2018-06-20 16:03:12Z bloehr

BL 2018-06-20: Ticket #184: Building with VS 2015: WIN64 and Windows threads (SOCKET instead of INT32)
BL 2014-07-14: Ticket #46: Protocol change: operational topocount needed
Ticket #47: Protocol change: no FCS for data part of telegrams

5.23.2

Function Documentation

5.23.2.1

trdp_pdCheck()

TRDP_ERR_T trdp_pdCheck (
PD_HEADER_T ∗ pPacket,
UINT32 packetSize )

Check if the PD header values and the CRCs are sane.
Parameters
in pPacket

in

packetSize

Return values
TRDP_NO_ERR
TRDP_CRC_ERR

Generated by Doxygen

pointer to the packet to check
max size to check

236

5.23.2.2

File Documentation

trdp_pdCheckListenSocks()

TRDP_ERR_T trdp_pdCheckListenSocks (
TRDP_SESSION_PT appHandle,
TRDP_FDS_T ∗ pRfds,
INT32 ∗ pCount )

Checking receive connection requests and data Call user's callback if needed.
Parameters

in
in
in,out

appHandle

session pointer

pRfds

pointer to set of ready descriptors

pCount

pointer to number of ready descriptors

Here is the call graph for this function:

trdp_pdCheckListenSocks

5.23.2.3

trdp_pdReceive

trdp_pdCheckPending()

void trdp_pdCheckPending (
TRDP_APP_SESSION_T appHandle,
TRDP_FDS_T ∗ pFileDesc,
INT32 ∗ pNoDesc )

Check for pending packets, set FD if non blocking.
Parameters

in
in,out
in,out

5.23.2.4

appHandle

session pointer

pFileDesc

pointer to set of ready descriptors

pNoDesc

pointer to number of ready descriptors

trdp_pdDistribute()

TRDP_ERR_T trdp_pdDistribute (
PD_ELE_T ∗ pSndQueue )
Generated by Doxygen

5.23 trdp_pdcom.h File Reference

237

Distribute send time of PD packets over time.
The duration of PD packets on a 100MBit/s network ranges from 3us to 150us max. Because a cyclic thread
scheduling below 5ms would put a too heavy load on the system, and PD packets cannot get larger than 1432 (+
UDP header), we will not account for differences in packet size. Another factor is the differences in intervals for
different packets: We should only change the starting times of the packets within 1/2 the interval time. Otherwise a
late addition of packets could lead to timeouts of already queued packets. Scheduling will be computed based on
the smallest interval time.
Parameters
in pSndQueue

pointer to send queue

Return values
TRDP_NO_ERR

Here is the call graph for this function:

vos_cmpTime

vos_divTime
trdp_pdDistribute
vos_mulTime

vos_addTime

5.23.2.5

trdp_pdHandleTimeOuts()

void trdp_pdHandleTimeOuts (
TRDP_SESSION_PT appHandle )

Check for time outs.
Parameters
in appHandle

Generated by Doxygen

application handle

238

File Documentation

Here is the call graph for this function:

trdp_pdHandleTimeOuts

5.23.2.6

vos_getTime

trdp_pdInit()

void trdp_pdInit (
PD_ELE_T ∗ pPacket,
TRDP_MSG_T type,
UINT32
UINT32
UINT32
UINT32

etbTopoCnt,
opTrnTopoCnt,
replyComId,
replyIpAddress )

Initialize/construct the packet Set the header infos.
Parameters
in pPacket

in
in
in
in
in

pointer to the packet element to init

type

type the packet

etbTopoCnt

topocount to use for PD frame

opTrnTopoCnt

topocount to use for PD frame

replyComId

Pull request comId

replyIpAddress

Pull request Ip

Here is the call graph for this function:

vos_htons
trdp_pdInit
vos_htonl

Generated by Doxygen

5.23 trdp_pdcom.h File Reference

5.23.2.7

239

trdp_pdPut()

TRDP_ERR_T trdp_pdPut (
PD_ELE_T ∗ pPacket,
TRDP_MARSHALL_T marshall,
void ∗ refCon,
const UINT8 ∗ pData,
UINT32 dataSize )

Copy data Update the data to be sent.
Parameters
in pPacket

in
in
in
in

marshall

pointer to marshalling function

refCon

reference for marshalling function

pData

pointer to data

dataSize

size of data

Return values
TRDP_NO_ERR

5.23.2.8

pointer to the packet element to send

no error other errors

trdp_pdReceive()

TRDP_ERR_T trdp_pdReceive (
TRDP_SESSION_PT appHandle,
SOCKET sock )

Receiving PD messages Read the receive socket for arriving PDs, copy the packet to a new PD_ELE_T Check for
protocol errors and compare the received data to the data in our receive queue.
If it is a new packet, check if it is a PD Request (PULL). If it is an update, exchange the existing entry with the new
one Call user's callback if needed
Parameters
in appHandle

in

sock

session pointer
the socket to read from

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_WIRE_ERR
TRDP_QUEUE_ERR
TRDP_CRC_ERR
TRDP_TOPOCOUNT_ERR

Generated by Doxygen

no error
parameter error
protocol error (late packet, version mismatch)
not in queue
header checksum
invalid topocount

240

5.23.2.9

File Documentation

trdp_pdSend()

TRDP_ERR_T trdp_pdSend (
SOCKET pdSock,
PD_ELE_T ∗ pPacket,
UINT16 port )

Send one PD packet.
Parameters
in pdSock

in
in

socket descriptor

pPacket

pointer to packet to be sent

port

port on which to send

Return values
TRDP_NO_ERR
TRDP_IO_ERR

5.23.2.10

trdp_pdSendQueued()

TRDP_ERR_T trdp_pdSendQueued (
TRDP_SESSION_PT appHandle )

Send all due PD messages.
Parameters
in appHandle

session pointer

Return values
TRDP_NO_ERR

no error

TRDP_IO_ERR

socket I/O error

Generated by Doxygen

5.24 trdp_private.h File Reference

241

Here is the call graph for this function:

vos_clearTime
trdp_pdSendQueued
vos_getTime

5.23.2.11

trdp_pdUpdate()

void trdp_pdUpdate (
PD_ELE_T ∗ pPacket )

Update the header values.
Parameters
in pPacket

pointer to the packet to update

Here is the call graph for this function:

vos_htons

trdp_pdUpdate

vos_htonl

vos_crc32

5.24

trdp_private.h File Reference

Typedefs for TRDP communication.

#include "trdp_types.h"
#include "vos_thread.h"
Generated by Doxygen

242

File Documentation

#include "vos_sock.h"
Include dependency graph for trdp_private.h:

trdp_private.h

trdp_types.h

iec61375-2-3.h

vos_mem.h

vos_sock.h

vos_thread.h

vos_private.h

vos_types.h

stdint.h

This graph shows which files directly or indirectly include this file:

trdp_private.h

trdp_utils.h

tau_tti.c

trdp_utils.c

tau_ctrl.c

tau_dnr.c

tau_marshall.c

trdp_mdcom.h

trdp_mdcom.c

tau_xml.c

trdp_xml.h

trdp_stats.h

trdp_xml.c

trdp_pdcom.c

trdp_pdcom.h

trdp_if.c

trdp_stats.c

Data Structures
• struct TRDP_HANDLE
Hidden handle definition, used as unique addressing item.

• struct TRDP_SEQ_CNT_ENTRY_T
Tuples of last received sequence counter per comId.

• struct TRDP_SOCKET_TCP
TCP parameters.

• struct TRDP_SOCKETS
Socket item.

• struct GNU_PACKED
Types for ETB control.

Generated by Doxygen

5.24 trdp_private.h File Reference

• struct GNU_PACKED
Types for ETB control.

• struct GNU_PACKED
Types for ETB control.

• struct PD_ELE
Queue element for PD packets to send or receive.

• struct TRDP_SESSION
Session/application variables store.

Macros
• #define TRDP_TIMER_GRANULARITY 10000u
granularity in us

• #define TRDP_DEBUG_DEFAULT_FILE_SIZE 65536u
Default maximum size of log file.

• #define TRDP_SEQ_CNT_START_ARRAY_SIZE 64u
This should be enough for the start.

• #define TRDP_IF_WAIT_FOR_READY 120u
120 seconds (120 tries each second to bind to an IP address)

• #define TRDP_PRIV_NONE 0u
Internal flags for packets.

• #define TRDP_TIMED_OUT 0x2u
if set, inform the user

• #define TRDP_INVALID_DATA 0x4u
if set, inform the user

• #define TRDP_REQ_2B_SENT 0x8u
if set, the request needs to be sent

• #define TRDP_PULL_SUB 0x10u
if set, its a PULL subscription

• #define TRDP_REDUNDANT 0x20u
if set, packet should not be sent (redundant)

• #define TRDP_CHECK_COMID 0x40u
if set, do filter comId (addListener)

Typedefs
• typedef struct TRDP_HANDLE TRDP_ADDRESSES_T
Hidden handle definition, used as unique addressing item.

• typedef struct TRDP_SOCKET_TCP TRDP_SOCKET_TCP_T
TCP parameters.

• typedef struct TRDP_SOCKETS TRDP_SOCKETS_T
Socket item.

• typedef struct PD_ELE PD_ELE_T
Queue element for PD packets to send or receive.

• typedef struct TRDP_SESSION TRDP_SESSION_T
Session/application variables store.
Generated by Doxygen

243

244

File Documentation

Enumerations
• enum TRDP_MD_ELE_ST_T {
TRDP_ST_NONE = 0u,
TRDP_ST_TX_NOTIFY_ARM = 1u,
TRDP_ST_TX_REQUEST_ARM = 2u,
TRDP_ST_TX_REPLY_ARM = 3u,
TRDP_ST_TX_REPLYQUERY_ARM = 4u,
TRDP_ST_TX_CONFIRM_ARM = 5u,
TRDP_ST_RX_READY = 6,
TRDP_ST_TX_REQUEST_W4REPLY = 7u,
TRDP_ST_RX_REPLYQUERY_W4C = 8u,
TRDP_ST_RX_REQ_W4AP_REPLY = 9u,
TRDP_ST_TX_REQ_W4AP_CONFIRM = 10u,
TRDP_ST_RX_REPLY_SENT = 11u,
TRDP_ST_RX_NOTIFY_RECEIVED = 12u,
TRDP_ST_TX_REPLY_RECEIVED = 13u,
TRDP_ST_RX_CONF_RECEIVED = 14u }
Internal MD state.

• enum TRDP_SOCK_TYPE_T {
TRDP_SOCK_PD = 0u,
TRDP_SOCK_MD_UDP = 1u,
TRDP_SOCK_MD_TCP = 2u }
Socket usage.

5.24.1

Detailed Description

Typedefs for TRDP communication.
TRDP internal type definitions
Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.
Id
trdp_private.h 1780 2018-11-07 09:51:13Z bloehr
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL

2018-06-20:
2017-11-28:
2017-11-17:
2017-11-17:
2017-05-08:
2017-05-08:
2017-02-28:
2017-02-28:
2015-08-31:
2015-08-05:
2014-06-02:

Ticket #184: Building with VS 2015: WIN64 and Windows threads (SOCKET instead of INT32)
Ticket #180 Filtering rules for DestinationURI does not follow the standard
superfluous session->redID replaced by sndQueue->redId
undone: Ticket #169 Encapsulate declaration of packed structures within a macro
Compiler warnings: enum flags to #defines
Ticket #155: Kill trdp_proto.h - move definitions to iec61375-2-3.h and here
Ticket #140 TRDP_TIMER_FOREVER ->
Ticket #142 Compiler warnings / MISRA-C 2012 issues
Ticket #94: "beQuiet" removed
Ticket #81: Counts for packet loss
Ticket #41: Sequence counter handling fixed
Generated by Doxygen

5.25 trdp_stats.c File Reference

5.24.2

Enumeration Type Documentation

5.24.2.1

TRDP_MD_ELE_ST_T

245

enum TRDP_MD_ELE_ST_T

Internal MD state.
Enumerator
TRDP_ST_NONE
TRDP_ST_TX_NOTIFY_ARM
TRDP_ST_TX_REQUEST_ARM
TRDP_ST_TX_REPLY_ARM
TRDP_ST_TX_REPLYQUERY_ARM
TRDP_ST_TX_CONFIRM_ARM
TRDP_ST_RX_READY
TRDP_ST_TX_REQUEST_W4REPLY
TRDP_ST_RX_REPLYQUERY_W4C
TRDP_ST_RX_REQ_W4AP_REPLY
TRDP_ST_TX_REQ_W4AP_CONFIRM
TRDP_ST_RX_REPLY_SENT
TRDP_ST_RX_NOTIFY_RECEIVED
TRDP_ST_TX_REPLY_RECEIVED
TRDP_ST_RX_CONF_RECEIVED

5.24.2.2

neutral value
ready to send notify MD
ready to send request MD
ready to send reply MD
ready to send reply with confirm request MD
ready to send confirm MD
armed listener
request sent, wait for reply
reply send, with confirm request MD
request received, wait for application reply send
reply conf. rq. tx, wait for application conf send
reply sent
notification received, wait for application to accept
reply received
confirmation received

TRDP_SOCK_TYPE_T

enum TRDP_SOCK_TYPE_T

Socket usage.
Enumerator
TRDP_SOCK_PD

Socket is used for UDP process data.

TRDP_SOCK_MD_UDP

Socket is used for UDP message data.

TRDP_SOCK_MD_TCP

Socket is used for TCP message data.

5.25

trdp_stats.c File Reference

Statistics functions for TRDP communication.
Generated by Doxygen

246

File Documentation

#include
#include
#include
#include
#include
#include
#include
#include
#include



"trdp_stats.h"
"trdp_if_light.h"
"trdp_if.h"
"trdp_private.h"
"trdp_pdcom.h"
"vos_mem.h"
"vos_thread.h"

Include dependency graph for trdp_stats.c:

trdp_stats.c

trdp_if.h

vos_utils.h

stdio.h

stddef.h

trdp_stats.h

trdp_if_light.h

trdp_pdcom.h

string.h

trdp_private.h

trdp_types.h

iec61375-2-3.h

vos_sock.h

vos_private.h

vos_mem.h

vos_thread.h

vos_types.h

stdint.h

Functions
• void trdp_UpdateStats (TRDP_APP_SESSION_T appHandle)
Update the statistics.

• void trdp_initStats (TRDP_APP_SESSION_T appHandle)
Init statistics.

• EXT_DECL TRDP_ERR_T tlc_resetStatistics (TRDP_APP_SESSION_T appHandle)
Reset statistics.

• EXT_DECL TRDP_ERR_T tlc_getStatistics (TRDP_APP_SESSION_T appHandle, TRDP_STATISTICS_T
∗pStatistics)
Return statistics.

• EXT_DECL TRDP_ERR_T tlc_getSubsStatistics (TRDP_APP_SESSION_T appHandle, UINT16 ∗pNum←Subs, TRDP_SUBS_STATISTICS_T ∗pStatistics)
Return PD subscription statistics.

• EXT_DECL TRDP_ERR_T tlc_getPubStatistics (TRDP_APP_SESSION_T appHandle, UINT16 ∗pNumPub,
TRDP_PUB_STATISTICS_T ∗pStatistics)
Return PD publish statistics.

• EXT_DECL TRDP_ERR_T tlc_getRedStatistics (TRDP_APP_SESSION_T appHandle, UINT16 ∗pNumRed,
TRDP_RED_STATISTICS_T ∗pStatistics)
Return redundancy group statistics.

Generated by Doxygen

5.25 trdp_stats.c File Reference

247

• EXT_DECL TRDP_ERR_T tlc_getJoinStatistics (TRDP_APP_SESSION_T appHandle, UINT16 ∗pNumJoin,
UINT32 ∗pIpAddr)
Return join statistics.

• void trdp_pdPrepareStats (TRDP_APP_SESSION_T appHandle, PD_ELE_T ∗pPacket)
Fill the statistics packet.

5.25.1

Detailed Description

Statistics functions for TRDP communication.
Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.
Id
trdp_stats.c 1740 2018-06-20 16:03:12Z bloehr

BL
BL
BL
BL
BL
BL
BL
BL

2018-06-20:
2017-11-17:
2017-05-22:
2017-05-08:
2017-03-01:
2016-07-06:
2016-05-04:
2015-08-05:

Ticket #184: Building with VS 2015: WIN64 and Windows threads (SOCKET instead of INT32)
superfluous session->redID replaced by sndQueue->redId
Ticket #122: Addendum for 64Bit compatibility (VOS_TIME_T -> VOS_TIMEVAL_T)
Compiler warnings
Ticket #149 SourceUri and DestinationUri don’t with 32 characters
Ticket #122 64Bit compatibility (+ compiler warnings)
Ticket #117: PD Status packet is not sent on request
Ticket #81: Counts for packet loss

5.25.2

Function Documentation

5.25.2.1

tlc_getJoinStatistics()

EXT_DECL TRDP_ERR_T tlc_getJoinStatistics (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pNumJoin,
UINT32 ∗ pIpAddr )

Return join statistics.
Memory for statistics information must be provided by the user.

Generated by Doxygen

248

File Documentation

Parameters

in
in,out
out

appHandle

the handle returned by tlc_openSession

pNumJoin

Pointer to the number of joined IP Adresses

pIpAddr

Pointer to a list with the joined IP adresses

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

TRDP_MEM_ERR

5.25.2.2

there are more items than requested

tlc_getPubStatistics()

EXT_DECL TRDP_ERR_T tlc_getPubStatistics (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pNumPub,
TRDP_PUB_STATISTICS_T ∗ pStatistics )

Return PD publish statistics.
Memory for statistics information must be provided by the user.
Parameters

in
in,out
out

appHandle

the handle returned by tlc_openSession

pNumPub

Pointer to the number of publishers

pStatistics

Pointer to a list with the publish statistics information

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

TRDP_MEM_ERR

5.25.2.3

there are more subscriptions than requested

tlc_getRedStatistics()

EXT_DECL TRDP_ERR_T tlc_getRedStatistics (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pNumRed,
TRDP_RED_STATISTICS_T ∗ pStatistics )

Return redundancy group statistics.
Memory for statistics information must be provided by the user.

Generated by Doxygen

5.25 trdp_stats.c File Reference
Parameters

in
in,out
out

appHandle

the handle returned by tlc_openSession

pNumRed

Pointer to the number of redundancy groups

pStatistics

Pointer to a list with the redundancy group information

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

TRDP_MEM_ERR

5.25.2.4

there are more subscriptions than requested

tlc_getStatistics()

EXT_DECL TRDP_ERR_T tlc_getStatistics (
TRDP_APP_SESSION_T appHandle,
TRDP_STATISTICS_T ∗ pStatistics )

Return statistics.
Memory for statistics information must be provided by the user.
Parameters
in
appHandle

out

pStatistics

Return values
TRDP_NO_ERR

the handle returned by tlc_openSession
Pointer to statistics for this application session

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

5.25.2.5

tlc_getSubsStatistics()

EXT_DECL TRDP_ERR_T tlc_getSubsStatistics (
TRDP_APP_SESSION_T appHandle,
UINT16 ∗ pNumSubs,
TRDP_SUBS_STATISTICS_T ∗ pStatistics )

Return PD subscription statistics.
Memory for statistics information must be provided by the user.

Generated by Doxygen

249

250

File Documentation

Parameters

in
in,out
in,out

appHandle

the handle returned by tlc_openSession

pNumSubs

In: The number of subscriptions requested Out: Number of subscriptions returned

pStatistics

Pointer to an array with the subscription statistics information

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

TRDP_MEM_ERR

5.25.2.6

there are more subscriptions than requested

tlc_resetStatistics()

EXT_DECL TRDP_ERR_T tlc_resetStatistics (
TRDP_APP_SESSION_T appHandle )

Reset statistics.
Parameters
in appHandle

the handle returned by tlc_openSession

Return values
TRDP_NO_ERR

no error

TRDP_NOINIT_ERR

handle invalid

TRDP_PARAM_ERR

parameter error

5.25.2.7

trdp_initStats()

void trdp_initStats (
TRDP_APP_SESSION_T appHandle )

Init statistics.
Clear the stats structure for a session.
Parameters
in appHandle

the handle returned by tlc_openSession

< host name
Generated by Doxygen

5.25 trdp_stats.c File Reference

251

< leader host name Here is the call graph for this function:

trdp_initStats

5.25.2.8

tlc_getVersion

trdp_pdPrepareStats()

void trdp_pdPrepareStats (
TRDP_APP_SESSION_T appHandle,
PD_ELE_T ∗ pPacket )

Fill the statistics packet.
Parameters

in
in,out

appHandle

the handle returned by tlc_openSession

pPacket

pointer to the packet to fill

Here is the call graph for this function:

trdp_UpdateStats
trdp_pdPrepareStats
vos_htonl

5.25.2.9

trdp_UpdateStats()

void trdp_UpdateStats (
TRDP_APP_SESSION_T appHandle )

Update the statistics.

Generated by Doxygen

252

File Documentation

Parameters
in appHandle

5.26

the handle returned by tlc_openSession

trdp_stats.h File Reference

Statistics for TRDP communication.

#include "trdp_if_light.h"
#include "trdp_private.h"
#include "vos_utils.h"
Include dependency graph for trdp_stats.h:

trdp_stats.h

trdp_private.h

trdp_if_light.h

trdp_types.h

vos_sock.h

vos_mem.h

vos_private.h

vos_utils.h

stdio.h

stddef.h

iec61375-2-3.h

vos_thread.h

vos_types.h

stdint.h

This graph shows which files directly or indirectly include this file:

trdp_stats.h

trdp_if.c

trdp_pdcom.c

trdp_stats.c

Generated by Doxygen

5.26 trdp_stats.h File Reference

253

Functions
• void trdp_initStats (TRDP_APP_SESSION_T appHandle)
Init statistics.

• void trdp_pdPrepareStats (TRDP_APP_SESSION_T appHandle, PD_ELE_T ∗pPacket)
Fill the statistics packet.

5.26.1

Detailed Description

Statistics for TRDP communication.
Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.

Id
trdp_stats.h 1065 2013-09-06 08:12:09Z aweiss

5.26.2

Function Documentation

5.26.2.1

trdp_initStats()

void trdp_initStats (
TRDP_APP_SESSION_T appHandle )

Init statistics.
Clear the stats structure for a session.
Parameters
in appHandle

< host name
Generated by Doxygen

the handle returned by tlc_openSession

254

File Documentation

< leader host name Here is the call graph for this function:

trdp_initStats

5.26.2.2

tlc_getVersion

trdp_pdPrepareStats()

void trdp_pdPrepareStats (
TRDP_APP_SESSION_T appHandle,
PD_ELE_T ∗ pPacket )

Fill the statistics packet.
Parameters

in
in,out

appHandle

the handle returned by tlc_openSession

pPacket

pointer to the packet to fill

Here is the call graph for this function:

trdp_UpdateStats
trdp_pdPrepareStats
vos_htonl

5.27

trdp_types.h File Reference

Typedefs for TRDP communication.

#include "vos_types.h"
#include "vos_mem.h"
#include "vos_sock.h"
Generated by Doxygen

5.27 trdp_types.h File Reference

255

#include "iec61375-2-3.h"
Include dependency graph for trdp_types.h:

trdp_types.h

vos_mem.h

vos_sock.h

vos_thread.h

iec61375-2-3.h

vos_private.h

vos_types.h

stdint.h

This graph shows which files directly or indirectly include this file:

trdp_types.h

tau_tti_types.h

tau_tti.h

tau_ctrl_types.h

tau_marshall.h

tau_dnr_types.h

tau_cstinfo.c

tau_ctrl.h

trdp_if_light.h

tau_dnr.h

trdp_private.h

trdp_mdcom.h

tau_dnr.c

tau_marshall.c

trdp_mdcom.c

trdp_utils.h

trdp_if.h

trdp_utils.c

trdp_pdcom.c

tau_xml.h

trdp_stats.h

trdp_pdcom.h

trdp_xml.h

trdp_if.c

trdp_stats.c

trdp_xml.c

tau_tti.c

tau_ctrl.c

Data Structures
• struct TRDP_PD_INFO_T
Process data info from received telegram; allows the application to generate responses.

• struct TRDP_MD_INFO_T
Message data info from received telegram; allows the application to generate responses.

• struct TRDP_SEND_PARAM_T
Quality/type of service and time to live.

• struct TRDP_DATASET_ELEMENT_T
Dataset element definition.

• struct TRDP_DATASET
Dataset definition.
Generated by Doxygen

tau_xml.c

256

File Documentation

• struct TRDP_COMID_DSID_MAP_T
ComId - data set mapping element definition.

• struct TRDP_STATISTICS_REQUEST_T
TRDP statistics type definitions.

• struct TRDP_MEM_STATISTICS_T
Structure containing all general memory statistics information.

• struct TRDP_PD_STATISTICS_T
Structure containing all general PD statistics information.

• struct TRDP_MD_STATISTICS_T
Structure containing all general MD statistics information.

• struct TRDP_STATISTICS_T
Structure containing all general memory, PD and MD statistics information.

• struct TRDP_SUBS_STATISTICS_T
Table containing particular PD subscription information.

• struct TRDP_PUB_STATISTICS_T
Table containing particular PD publishing information.

• struct TRDP_LIST_STATISTICS_T
Information about a particular MD listener.

• struct TRDP_RED_STATISTICS_T
A table containing PD redundant group information.

• struct TRDP_MARSHALL_CONFIG_T
Marshaling/unmarshalling configuration.

• struct TRDP_PD_CONFIG_T
Default PD configuration.

• struct TRDP_MD_CONFIG_T
Default MD configuration.

• struct TRDP_MEM_CONFIG_T
Enumeration type for memory pre-fragmentation, reuse of VOS definition.

• struct TRDP_PROCESS_CONFIG_T
Various flags/general TRDP options for library initialization.

Macros
• #define USE_HEAP 0
If this is set, we can allocate dynamically memory.

• #define TRDP_FLAGS_DEFAULT 0u
Various flags for PD and MD packets.

• #define TRDP_FLAGS_NONE 0x01u
No flags set.

• #define TRDP_FLAGS_MARSHALL 0x02u
Optional marshalling/unmarshalling in TRDP stack.

• #define TRDP_FLAGS_CALLBACK 0x04u
Use of callback function.

• #define TRDP_FLAGS_TCP 0x08u
Use TCP for message data.

• #define TRDP_FLAGS_FORCE_CB 0x10u
Force a callback for every received packet.

• #define TRDP_INFINITE_TIMEOUT 0xffffffffu
Infinite reply timeout.

• #define TRDP_TIMER_FOREVER 0xffffffff
Generated by Doxygen

5.27 trdp_types.h File Reference

257

No time out for subscription.

• #define TRDP_BOOL8 TRDP_BITSET8
1 bit relevant (equal to zero = false, not equal to zero = true)

• #define TRDP_ANTIVALENT8 TRDP_BITSET8
2 bit relevant (0x0 = errror, 0x01 = false, 0x02 = true, 0x03 undefined)

• #define TRDP_OPTION_NONE 0u
Various flags/general TRDP options for library initialization.

• #define TRDP_OPTION_BLOCK 0x01u
Default: Use nonblocking I/O calls, polling necessary Set: Read calls will block, use select()

• #define TRDP_OPTION_TRAFFIC_SHAPING 0x02u
Use traffic shaping - distribute packet sending Default: OFF.

• #define TRDP_OPTION_NO_REUSE_ADDR 0x04u
Do not allow re-use of address/port (-> no multihoming) Default: Allow.
• #define TRDP_OPTION_NO_MC_LOOP_BACK 0x08u
Do not allow loop back of multicast traffic Default: Allow.

• #define TRDP_OPTION_NO_UDP_CHK 0x10u
Suppress UDP CRC generation Default: Compute UDP CRC.

Typedefs
• typedef VOS_IP4_ADDR_T TRDP_IP_ADDR_T
TRDP general type definitions.

• typedef CHAR8 TRDP_NET_LABEL_T[TRDP_MAX_LABEL_LEN]
Definition for usage in network packets, not necessarily \0 terminated!

• typedef VOS_VERSION_T TRDP_VERSION_T
Version information.

• typedef VOS_TIMEVAL_T TRDP_TIME_T
Timer value compatible with timeval / select.

• typedef VOS_FDS_T TRDP_FDS_T
File descriptor set compatible with fd_set / select.

• typedef VOS_UUID_T TRDP_UUID_T
UUID definition reuses the VOS definition.

• typedef struct TRDP_DATASET TRDP_DATASET_T
Dataset definition.

• typedef TRDP_DATASET_T ∗ pTRDP_DATASET_T
Array of pointers to dataset.

• typedef VOS_PRINT_DBG_T TRDP_PRINT_DBG_T
TRDP configuration type definitions.

• typedef VOS_LOG_T TRDP_LOG_T
Categories for logging, reuse of the VOS definition.

• typedef TRDP_ERR_T(∗ TRDP_MARSHALL_T) (void ∗pRefCon, UINT32 comId, UINT8 ∗pSrc, UINT32
srcSize, UINT8 ∗pDst, UINT32 ∗pDstSize, TRDP_DATASET_T ∗∗ppCachedDS)
Function type for marshalling .

• typedef TRDP_ERR_T(∗ TRDP_UNMARSHALL_T) (void ∗pRefCon, UINT32 comId, UINT8 ∗pSrc, UINT32
srcSize, UINT8 ∗pDst, UINT32 ∗pDstSize, TRDP_DATASET_T ∗∗ppCachedDS)
Function type for unmarshalling.

• typedef void(∗ TRDP_PD_CALLBACK_T) (void ∗pRefCon, TRDP_APP_SESSION_T appHandle, const T←RDP_PD_INFO_T ∗pMsg, UINT8 ∗pData, UINT32 dataSize)
Callback for receiving indications, timeouts, releases, responses.

• typedef void(∗ TRDP_MD_CALLBACK_T) (void ∗pRefCon, TRDP_APP_SESSION_T appHandle, const T←RDP_MD_INFO_T ∗pMsg, UINT8 ∗pData, UINT32 dataSize)
Callback for receiving indications, timeouts, releases, responses.
Generated by Doxygen

258

File Documentation

Enumerations
• enum TRDP_ERR_T {
TRDP_NO_ERR = 0,
TRDP_PARAM_ERR = -1,
TRDP_INIT_ERR = -2,
TRDP_NOINIT_ERR = -3,
TRDP_TIMEOUT_ERR = -4,
TRDP_NODATA_ERR = -5,
TRDP_SOCK_ERR = -6,
TRDP_IO_ERR = -7,
TRDP_MEM_ERR = -8,
TRDP_SEMA_ERR = -9,
TRDP_QUEUE_ERR = -10,
TRDP_QUEUE_FULL_ERR = -11,
TRDP_MUTEX_ERR = -12,
TRDP_THREAD_ERR = -13,
TRDP_BLOCK_ERR = -14,
TRDP_INTEGRATION_ERR = -15,
TRDP_NOCONN_ERR = -16,
TRDP_NOSESSION_ERR = -30,
TRDP_SESSION_ABORT_ERR = -31,
TRDP_NOSUB_ERR = -32,
TRDP_NOPUB_ERR = -33,
TRDP_NOLIST_ERR = -34,
TRDP_CRC_ERR = -35,
TRDP_WIRE_ERR = -36,
TRDP_TOPO_ERR = -37,
TRDP_COMID_ERR = -38,
TRDP_STATE_ERR = -39,
TRDP_APP_TIMEOUT_ERR = -40,
TRDP_APP_REPLYTO_ERR = -41,
TRDP_APP_CONFIRMTO_ERR = -42,
TRDP_REPLYTO_ERR = -43,
TRDP_CONFIRMTO_ERR = -44,
TRDP_REQCONFIRMTO_ERR = -45,
TRDP_PACKET_ERR = -46,
TRDP_UNRESOLVED_ERR = -47,
TRDP_XML_PARSER_ERR = -48,
TRDP_INUSE_ERR = -49,
TRDP_MARSHALLING_ERR = -50,
TRDP_UNKNOWN_ERR = -99 }
Return codes for all API functions, -1..-29 taken over from vos.

• enum TRDP_REPLY_STATUS_T
TRDP data transfer type definitions.

• enum TRDP_RED_STATE_T {
TRDP_RED_FOLLOWER = 0u,
TRDP_RED_LEADER = 1u }
Redundancy states.

• enum TRDP_TO_BEHAVIOR_T {
TRDP_TO_DEFAULT = 0u,
TRDP_TO_SET_TO_ZERO = 1u,
TRDP_TO_KEEP_LAST_VALUE = 2u }
How invalid PD shall be handled.

• enum TRDP_DATA_TYPE_T {
TRDP_INVALID = 0u,
TRDP_BITSET8 = 1u,
Generated by Doxygen

5.27 trdp_types.h File Reference

259

TRDP_CHAR8 = 2u,
TRDP_UTF16 = 3u,
TRDP_INT8 = 4u,
TRDP_INT16 = 5u,
TRDP_INT32 = 6u,
TRDP_INT64 = 7u,
TRDP_UINT8 = 8u,
TRDP_UINT16 = 9u,
TRDP_UINT32 = 10u,
TRDP_UINT64 = 11u,
TRDP_REAL32 = 12u,
TRDP_REAL64 = 13u,
TRDP_TIMEDATE32 = 14u,
TRDP_TIMEDATE48 = 15u,
TRDP_TIMEDATE64 = 16u,
TRDP_TYPE_MAX = 30u }
TRDP dataset description definitions.

5.27.1

Detailed Description

Typedefs for TRDP communication.
F

Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2015. All rights reserved.

BL
BL
BL
BL
AHW
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL

2018-09-05:
2018-05-02:
2017-11-13:
2017-05-22:
2017-05-22:
2017-05-08:
2017-04-28:
2017-03-01:
2017-02-27:
2016-06-08:
2016-02-11:
2016-01-25:
2015-12-14:
2015-08-05:
2014-07-14:
2014-02-27:

Generated by Doxygen

Ticket #211 XML handling: Dataset Name should be stored in TRDP_DATASET_ELEMENT_T
Ticket #188 Typo in the TRDP_VAR_SIZE definition
Ticket #176 TRDP_LABEL_T breaks field alignment -> TRDP_NET_LABEL_T
Ticket #122: Addendum for 64Bit compatibility (VOS_TIME_T -> VOS_TIMEVAL_T)
Ticket #158 Infinit timeout at TRDB level is 0 acc. standard
Compiler warnings, doxygen comment errors
Ticket #155: Kill trdp_proto.h - move definitions to iec61375-2-3.h
Ticket #149 SourceUri and DestinationUri don’t with 32 characters
Ticket #142 Compiler warnings / MISRA-C 2012 issues
Ticket #120: ComIds for statistics changed to proposed 61375 errata
Ticket #111: ’unit’, ’scale’, ’offset’ attributes added to TRDP_DATASET_ELEMENT
Ticket #106: User needs to be informed on every received PD packet
Ticket #33: source size check for marshalling
Ticket #81: Counts for packet loss
Ticket #46: Protocol change: operational topocount needed
Ticket #17: tlp_subscribe() returns wrong *pSubHandle

260

File Documentation

5.27.2

Macro Definition Documentation

5.27.2.1

TRDP_FLAGS_DEFAULT

#define TRDP_FLAGS_DEFAULT 0u

Various flags for PD and MD packets.
Default value defined in tlc_openDession will be taken

5.27.3

Typedef Documentation

5.27.3.1

TRDP_IP_ADDR_T

typedef VOS_IP4_ADDR_T TRDP_IP_ADDR_T

TRDP general type definitions.

5.27.3.2

TRDP_MARSHALL_T

typedef TRDP_ERR_T(∗ TRDP_MARSHALL_T) (void ∗pRefCon, UINT32 comId, UINT8 ∗pSrc, UINT32 src←Size, UINT8 ∗pDst, UINT32 ∗pDstSize, TRDP_DATASET_T ∗∗ppCachedDS)

Function type for marshalling .
The function must know about the dataset's alignment etc.
Parameters

in
in
in
in
in
in,out
in,out

pRefCon

pointer to user context

comId

ComId to identify the structure out of a configuration

pSrc

pointer to received original message

srcSize
pDst

size of the source buffer
pointer to a buffer for the treated message

pDstSize

size of the provide buffer / size of the treated message

ppCachedDS

pointer to pointer of cached dataset

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_COMID_ERR

no error
provided buffer to small
comid not existing
Generated by Doxygen

5.27 trdp_types.h File Reference

5.27.3.3

261

TRDP_MD_CALLBACK_T

typedef void(∗ TRDP_MD_CALLBACK_T) (void ∗pRefCon, TRDP_APP_SESSION_T appHandle, const TRDP_M←D_INFO_T ∗pMsg, UINT8 ∗pData, UINT32 dataSize)

Callback for receiving indications, timeouts, releases, responses.
Parameters
in appHandle

in
in
in
in

5.27.3.4

handle returned also by tlc_init

pRefCon

pointer to user context

pMsg

pointer to received message information

pData

pointer to received data

dataSize

size of received data pointer to received data

TRDP_PD_CALLBACK_T

typedef void(∗ TRDP_PD_CALLBACK_T) (void ∗pRefCon, TRDP_APP_SESSION_T appHandle, const TRDP_P←D_INFO_T ∗pMsg, UINT8 ∗pData, UINT32 dataSize)

Callback for receiving indications, timeouts, releases, responses.
Parameters
in pRefCon

in
in
in
in

5.27.3.5

pointer to user context

appHandle

application handle returned by tlc_openSession

pMsg

pointer to received message information

pData

pointer to received data

dataSize

size of received data pointer to received data

TRDP_PRINT_DBG_T

typedef VOS_PRINT_DBG_T TRDP_PRINT_DBG_T

TRDP configuration type definitions.
Callback function definition for error/debug output, reuse of the VOS defined function.

5.27.3.6

TRDP_TIME_T

typedef VOS_TIMEVAL_T TRDP_TIME_T

Timer value compatible with timeval / select.
Relative or absolute date, depending on usage
Generated by Doxygen

262

File Documentation

5.27.3.7

TRDP_UNMARSHALL_T

typedef TRDP_ERR_T(∗ TRDP_UNMARSHALL_T) (void ∗pRefCon, UINT32 comId, UINT8 ∗pSrc, UINT32 src←Size, UINT8 ∗pDst, UINT32 ∗pDstSize, TRDP_DATASET_T ∗∗ppCachedDS)

Function type for unmarshalling.
The function must know about the dataset's alignment etc.
Parameters

in
in
in
in
in
in,out
in,out

pRefCon

pointer to user context

comId

ComId to identify the structure out of a configuration

pSrc

pointer to received original message

srcSize

data length from TRDP packet header

pDst

pointer to a buffer for the treated message

pDstSize

size of the provide buffer / size of the treated message

ppCachedDS

pointer to pointer of cached dataset

Return values
TRDP_NO_ERR
TRDP_MEM_ERR
TRDP_COMID_ERR

no error
provide buffer to small
comid not existing

5.27.4

Enumeration Type Documentation

5.27.4.1

TRDP_DATA_TYPE_T

enum TRDP_DATA_TYPE_T

TRDP dataset description definitions.
Dataset element definition
Enumerator
TRDP_INVALID
TRDP_BITSET8
TRDP_CHAR8
TRDP_UTF16

Invalid/unknown.
=UINT8
char, can be used also as UTF8
Unicode UTF-16 character.

TRDP_INT8

Signed integer, 8 bit.

TRDP_INT16

Signed integer, 16 bit.

TRDP_INT32

Signed integer, 32 bit.

TRDP_INT64

Signed integer, 64 bit.

TRDP_UINT8

Unsigned integer, 8 bit.

TRDP_UINT16

Unsigned integer, 16 bit.

Generated by Doxygen

5.27 trdp_types.h File Reference

263

Enumerator
TRDP_UINT32

Unsigned integer, 32 bit.

TRDP_UINT64

Unsigned integer, 64 bit.

TRDP_REAL32

Floating point real, 32 bit.

TRDP_REAL64

Floating point real, 64 bit.

TRDP_TIMEDATE32

32 bit UNIX time

TRDP_TIMEDATE48

48 bit TCN time (32 bit UNIX time and 16 bit ticks)

TRDP_TIMEDATE64

32 bit UNIX time + 32 bit microseconds

TRDP_TYPE_MAX

5.27.4.2

Values greater are considered nested datasets.

TRDP_ERR_T

enum TRDP_ERR_T

Return codes for all API functions, -1..-29 taken over from vos.
Enumerator
TRDP_NO_ERR
TRDP_PARAM_ERR
TRDP_INIT_ERR
TRDP_NOINIT_ERR
TRDP_TIMEOUT_ERR
TRDP_NODATA_ERR
TRDP_SOCK_ERR
TRDP_IO_ERR
TRDP_MEM_ERR
TRDP_SEMA_ERR
TRDP_QUEUE_ERR
TRDP_QUEUE_FULL_ERR
TRDP_MUTEX_ERR
TRDP_THREAD_ERR

No error.
Parameter missing or out of range.
Call without valid initialization.
Call with invalid handle.
Timout.
Non blocking mode: no data received.
Socket error / option not supported.
Socket IO error, data can't be received/sent.
No more memory available.
Semaphore not available.
Queue empty.
Queue full.
Mutex not available.
Thread error.

TRDP_BLOCK_ERR

System call would have blocked in blocking mode.

TRDP_INTEGRATION_ERR

Alignment or endianess for selected target wrong.

TRDP_NOCONN_ERR

No TCP connection.

TRDP_NOSESSION_ERR

No such session.

TRDP_SESSION_ABORT_ERR

Session aborted.

TRDP_NOSUB_ERR

No subscriber.

TRDP_NOPUB_ERR

No publisher.

TRDP_NOLIST_ERR

No listener.

TRDP_CRC_ERR

Wrong CRC.

TRDP_WIRE_ERR

Wire.

TRDP_TOPO_ERR

Invalid topo count.

TRDP_COMID_ERR

Unknown ComId.

TRDP_STATE_ERR

Call in wrong state.

TRDP_APP_TIMEOUT_ERR

Application Timeout.

TRDP_APP_REPLYTO_ERR

Application Reply Sent Timeout.

Generated by Doxygen

264

File Documentation

Enumerator
TRDP_APP_CONFIRMTO_ERR
TRDP_REPLYTO_ERR
TRDP_CONFIRMTO_ERR
TRDP_REQCONFIRMTO_ERR
TRDP_PACKET_ERR

Application Confirm Sent Timeout.
Protocol Reply Timeout.
Protocol Confirm Timeout.
Protocol Confirm Timeout (Request sender)
Incomplete message data packet.

TRDP_UNRESOLVED_ERR

DNR: address could not be resolved.

TRDP_XML_PARSER_ERR

Returned by the tau_xml subsystem.

TRDP_INUSE_ERR
TRDP_MARSHALLING_ERR
TRDP_UNKNOWN_ERR

5.27.4.3

Resource is still in use.
Source size exceeded, dataset mismatch.
Unspecified error.

TRDP_RED_STATE_T

enum TRDP_RED_STATE_T

Redundancy states.
Enumerator
TRDP_RED_FOLLOWER
TRDP_RED_LEADER

5.27.4.4

Redundancy follower - redundant PD will be not sent out.
Redundancy leader - redundant PD will be sent out.

TRDP_REPLY_STATUS_T

enum TRDP_REPLY_STATUS_T

TRDP data transfer type definitions.
Reply status messages

5.27.4.5

TRDP_TO_BEHAVIOR_T

enum TRDP_TO_BEHAVIOR_T

How invalid PD shall be handled.
Enumerator
TRDP_TO_DEFAULT

Default value defined in tlc_openDession will be taken.

TRDP_TO_SET_TO_ZERO

If set, data will be reset to zero on time out.

TRDP_TO_KEEP_LAST_VALUE

If set, last received values will be returned.

Generated by Doxygen

5.28 trdp_utils.c File Reference

5.28

265

trdp_utils.c File Reference

Helper functions for TRDP communication.

#include 
#include "trdp_if.h"
#include "trdp_utils.h"
Include dependency graph for trdp_utils.c:

trdp_utils.c

string.h

trdp_if.h

trdp_if_light.h

trdp_utils.h

trdp_private.h

trdp_types.h

vos_mem.h

iec61375-2-3.h

vos_thread.h

vos_utils.h

stddef.h

stdio.h

vos_sock.h

vos_private.h

vos_types.h

stdint.h

Functions
• INT32 trdp_getCurrentMaxSocketCnt ()
Return the largest number of the socket index.

• TRDP_IP_ADDR_T trdp_findMCjoins (TRDP_APP_SESSION_T appHandle, TRDP_IP_ADDR_T mcGroup)
Check an MC group not used by other sockets / subscribers/ listeners.

• UINT32 trdp_packetSizePD (UINT32 dataSize)
Get the packet size from the raw data size.

• UINT32 trdp_packetSizeMD (UINT32 dataSize)
Get the packet size from the raw data size.

• PD_ELE_T ∗ trdp_queueFindComId (PD_ELE_T ∗pHead, UINT32 comId)
Return the element with same comId.

• PD_ELE_T ∗ trdp_queueFindPubAddr (PD_ELE_T ∗pHead, TRDP_ADDRESSES_T ∗addr)
Return the element with same comId and IP addresses.

• PD_ELE_T ∗ trdp_queueFindSubAddr (PD_ELE_T ∗pHead, TRDP_ADDRESSES_T ∗addr)
Return the element with same comId and IP addresses.

• void trdp_queueDelElement (PD_ELE_T ∗∗ppHead, PD_ELE_T ∗pDelete)
Generated by Doxygen

266

File Documentation

Delete an element.

• BOOL8 trdp_validTopoCounters (UINT32 etbTopoCnt, UINT32 opTrnTopoCnt, UINT32 etbTopoCntFilter, U←INT32 opTrnTopoCntFilter)
Check topography counters The applied conformance pattern follows Table A.5/A.21 (positive match): Telegram to be
sent Locally stored value (appSession) Case etbTopoCnt opTrnTopoCnt etbTopoCntFilter opTrnTopoCntFilter 1 any
any 0 0 2 any equal 0 equal 3 equal any equal 0 4 equal equal equal equal.

• void trdp_queueAppLast (PD_ELE_T ∗∗ppHead, PD_ELE_T ∗pNew)
Append an element at end of queue.

• void trdp_queueInsFirst (PD_ELE_T ∗∗ppHead, PD_ELE_T ∗pNew)
Insert an element at front of queue.

• void trdp_initSockets (TRDP_SOCKETS_T iface[ ])
Handle the socket pool: Initialize it.

• TRDP_ERR_T trdp_requestSocket (TRDP_SOCKETS_T iface[ ], UINT16 port, const TRDP_SEND_PA←RAM_T ∗params, TRDP_IP_ADDR_T srcIP, TRDP_IP_ADDR_T mcGroup, TRDP_SOCK_TYPE_T type,
TRDP_OPTION_T options, BOOL8 rcvMostly, SOCKET useSocket, INT32 ∗pIndex, TRDP_IP_ADDR_←T cornerIp)
Handle the socket pool: Request a socket from our socket pool First we loop through the socket pool and check if
there is already a socket which would suit us.

• void trdp_releaseSocket (TRDP_SOCKETS_T iface[ ], INT32 lIndex, UINT32 connectTimeout, BOOL8
checkAll, TRDP_IP_ADDR_T mcGroupUsed)
Handle the socket pool: if a received TCP socket is unused, the socket connection timeout is started.

• UINT32 trdp_getSeqCnt (UINT32 comId, TRDP_MSG_T msgType, TRDP_IP_ADDR_T srcIpAddr)
Get the initial sequence counter for the comID/message type and subnet (source IP).

• void trdp_resetSequenceCounter (PD_ELE_T ∗pElement, TRDP_IP_ADDR_T srcIP, TRDP_MSG_T msg←Type)
remove the sequence counter for the comID/source IP.

• int trdp_checkSequenceCounter (PD_ELE_T ∗pElement, UINT32 sequenceCounter, TRDP_IP_ADDR_←T srcIP, TRDP_MSG_T msgType)
check and update the sequence counter for the comID/source IP.

• BOOL8 trdp_isAddressed (const TRDP_URI_USER_T listUri, const TRDP_URI_USER_T destUri)
Check if listener URI is in addressing range of destination URI.

• BOOL8 trdp_isInIPrange (TRDP_IP_ADDR_T receivedSrcIP, TRDP_IP_ADDR_T listenedSourceIPlow, T←RDP_IP_ADDR_T listenedSourceIPhigh)
Check if received IP is in addressing range of listener's IPs.

5.28.1

Detailed Description

Helper functions for TRDP communication.

Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH

Generated by Doxygen

5.28 trdp_utils.c File Reference

267

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.

Id
trdp_utils.c 1779 2018-11-07 09:49:55Z bloehr

BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL
BL

2018-11-06:
2018-11-06:
2018-06-20:
2018-02-03:
2017-11-28:
2017-11-15:
2017-11-15:
2017-11-09:
2017-11-06:
2017-11-06:
2017-06-07:
2017-05-08:
2017-05-08:
2017-03-01:
2016-07-06:
2016-03-01:
2014-08-25:
2014-06-02:

for-loops limited to sCurrentMaxSocketCnt instead VOS_MAX_SOCKET_CNT
Ticket #219: PD Sequence Counter is not synched correctly
Ticket #184: Building with VS 2015: WIN64 and Windows threads (SOCKET instead of INT32)
Ticket #190 Source filtering (IP-range) for PD subscribe
Ticket #180 Filtering rules for DestinationURI does not follow the standard
Ticket #1
Unjoin on unsubscribe/delListener (finally ;-)
Ticket #175 PD: Handling of sequence counter
Ticket #181/182 Missing padding bytes in user dataset of PD/MD-PDU
Ticket #178 trdp_releaseSocket does not cleanup tcpParams
Ticket #174 Socket is closed, even if in use
Undoing setting of usage (came in with #126 fix!)
Ticket #126 Opened UDP socket is not released if join or bind failed in trdp_requestSocket()
Compiler warnings, static definitions
Ticket #136 PD topography counter with faulty behavior
Ticket #122 64Bit compatibility (+ compiler warnings)
Setting correct multicast TTL for PDs
Ticket #57+58: Padding / zero bytes trailing MD & PD packets fixed
Ticket #41: Sequence counter handling fixed

5.28.2

Function Documentation

5.28.2.1

trdp_checkSequenceCounter()

int trdp_checkSequenceCounter (
PD_ELE_T ∗ pElement,
UINT32 sequenceCounter,
TRDP_IP_ADDR_T srcIP,
TRDP_MSG_T msgType )

check and update the sequence counter for the comID/source IP.
If the comID/srcIP is not found, update it and return 0 - else if already received, return 1 On memory error, return -1
Parameters
in pElement

in
in
in

subscription element

sequenceCounter

sequence counter to check

srcIP
msgType

Source IP address
type of the message

Return values
0 - no duplicate 1 - duplicate or old sequence counter -1 - memory error

Generated by Doxygen

268

File Documentation

Here is the call graph for this function:

vos_memAlloc

trdp_checkSequenceCounter

vos_ipDotted

vos_memFree

5.28.2.2

trdp_findMCjoins()

TRDP_IP_ADDR_T trdp_findMCjoins (
TRDP_APP_SESSION_T appHandle,
TRDP_IP_ADDR_T mcGroup )

Check an MC group not used by other sockets / subscribers/ listeners.
Parameters
in appHandle
mcGroup

in

the handle returned by tlc_openSession
multicast group to look for

Return values
multi cast group if unused VOS_INADDR_ANY if used

5.28.2.3

trdp_getCurrentMaxSocketCnt()

INT32 trdp_getCurrentMaxSocketCnt (
void )

Return the largest number of the socket index.
Returns
maxSocketCount

Generated by Doxygen

5.28 trdp_utils.c File Reference

5.28.2.4

269

trdp_getSeqCnt()

UINT32 trdp_getSeqCnt (
UINT32 comId,
TRDP_MSG_T msgType,
TRDP_IP_ADDR_T srcIpAddr )

Get the initial sequence counter for the comID/message type and subnet (source IP).
If the comID/srcIP is not found elsewhere, return 0 - else return its current sequence number (the redundant packet
needs the same seqNo)
Note: The standard demands that sequenceCounter is managed per comID/msgType at each publisher, but shall
be the same for redundant telegrams (subnet/srcIP).
Parameters
in comId
in msgType

in

srcIpAddr

comID to look for
PD/MD type
Source IP address

Return values
return the sequence number

5.28.2.5

trdp_initSockets()

void trdp_initSockets (
TRDP_SOCKETS_T iface[ ] )

Handle the socket pool: Initialize it.
Parameters
in iface

5.28.2.6

pointer to the socket pool

trdp_isAddressed()

BOOL8 trdp_isAddressed (
const TRDP_URI_USER_T listUri,
const TRDP_URI_USER_T destUri )

Check if listener URI is in addressing range of destination URI.
Parameters
in listUri

in

destUri

Generated by Doxygen

Null terminated listener URI string to compare
Null terminated destination URI string to compare

270

File Documentation

Return values
FALSE - not in addressing range
TRUE

5.28.2.7

- listener URI is in addressing range of destination URI

trdp_isInIPrange()

BOOL8 trdp_isInIPrange (
TRDP_IP_ADDR_T receivedSrcIP,
TRDP_IP_ADDR_T listenedSourceIPlow,
TRDP_IP_ADDR_T listenedSourceIPhigh )

Check if received IP is in addressing range of listener's IPs.
Parameters
in receivedSrcIP
in listenedSourceIPlow
in listenedSourceIPhigh

Received IP address
Lower bound IP
Upper bound IP

Return values
FALSE - not in addressing range
TRUE

5.28.2.8

- received IP is in addressing range of listener

trdp_packetSizeMD()

UINT32 trdp_packetSizeMD (
UINT32 dataSize )

Get the packet size from the raw data size.
Parameters
in dataSize

net data size (without padding)

Return values
packet size the size of the complete packet to be sent or received

5.28.2.9

trdp_packetSizePD()

UINT32 trdp_packetSizePD (
Generated by Doxygen

5.28 trdp_utils.c File Reference

UINT32 dataSize )

Get the packet size from the raw data size.
Parameters
in dataSize

net data size (without padding)

Return values
packet size the size of the complete packet to be sent or received

5.28.2.10

trdp_queueAppLast()

void trdp_queueAppLast (
PD_ELE_T ∗∗ ppHead,
PD_ELE_T ∗ pNew )

Append an element at end of queue.
Parameters
in ppHead

in

5.28.2.11

pNew

pointer to pointer to head of queue
pointer to element to append

trdp_queueDelElement()

void trdp_queueDelElement (
PD_ELE_T ∗∗ ppHead,
PD_ELE_T ∗ pDelete )

Delete an element.
Parameters
in ppHead

in

5.28.2.12

pDelete

pointer to pointer to head of queue
pointer to element to delete

trdp_queueFindComId()

PD_ELE_T∗ trdp_queueFindComId (
PD_ELE_T ∗ pHead,
UINT32 comId )
Generated by Doxygen

271

272

File Documentation

Return the element with same comId.

Generated by Doxygen

5.28 trdp_utils.c File Reference
Parameters
in pHead

in

comId

pointer to head of queue
ComID to search for

Return values
!= NULL pointer to PD element
NULL

No PD element found

5.28.2.13

trdp_queueFindPubAddr()

PD_ELE_T∗ trdp_queueFindPubAddr (
PD_ELE_T ∗ pHead,
TRDP_ADDRESSES_T ∗ addr )

Return the element with same comId and IP addresses.
Parameters
in pHead

in

addr

pointer to head of queue
Pub/Sub handle (Address, ComID, srcIP & dest IP) to search for

Return values
!= NULL pointer to PD element
NULL

No PD element found

5.28.2.14

trdp_queueFindSubAddr()

PD_ELE_T∗ trdp_queueFindSubAddr (
PD_ELE_T ∗ pHead,
TRDP_ADDRESSES_T ∗ addr )

Return the element with same comId and IP addresses.
Parameters
in pHead

in

addr

pointer to head of queue
Pub/Sub handle (Address, ComID, srcIP & dest IP) to search for

Return values
!= NULL pointer to PD element
NULL

No PD element found

Generated by Doxygen

273

274

5.28.2.15

File Documentation

trdp_queueInsFirst()

void trdp_queueInsFirst (
PD_ELE_T ∗∗ ppHead,
PD_ELE_T ∗ pNew )

Insert an element at front of queue.
Parameters
in ppHead

in

5.28.2.16

pNew

pointer to pointer to head of queue
pointer to element to insert

trdp_releaseSocket()

void trdp_releaseSocket (
TRDP_SOCKETS_T iface[ ],
INT32 lIndex,
UINT32 connectTimeout,
BOOL8 checkAll,
TRDP_IP_ADDR_T mcGroupUsed )

Handle the socket pool: if a received TCP socket is unused, the socket connection timeout is started.
Handle the socket pool: Release a socket from our socket pool.
In Udp, Release a socket from our socket pool
Parameters

in,out
in
in
in
in

5.28.2.17

iface

socket pool

lIndex
connectTimeout
checkAll

index of socket to release
time out
release all TCP pending sockets

mcGroupUsed

release MC group subscription

trdp_requestSocket()

TRDP_ERR_T trdp_requestSocket (
TRDP_SOCKETS_T iface[ ],
UINT16 port,
const TRDP_SEND_PARAM_T ∗ params,
TRDP_IP_ADDR_T srcIP,
Generated by Doxygen

5.28 trdp_utils.c File Reference

275

TRDP_IP_ADDR_T mcGroup,
TRDP_SOCK_TYPE_T type,
TRDP_OPTION_T options,
BOOL8 rcvMostly,
SOCKET useSocket,
INT32 ∗ pIndex,
TRDP_IP_ADDR_T cornerIp )

Handle the socket pool: Request a socket from our socket pool First we loop through the socket pool and check if
there is already a socket which would suit us.
If a multicast group should be joined, we do that on an otherwise suitable socket - up to 20 multicast goups can
be joined per socket. If a socket for multicast publishing is requested, we also use the source IP to determine the
interface for outgoing multicast traffic.
Parameters

in,out
in
in
in
in
in
in
in
out
out
in

iface

socket pool

port

port to use

params

parameters to use

srcIP

IP to bind to (0 = any address)

mcGroup

MC group to join (0 = do not join)

type

type determines port to bind to (PD, MD/UDP, MD/TCP)

options

blocking/nonblocking

rcvMostly

primarily used for receiving (tbd: bind on sender, too?)

useSocket

socket to use, do not open a new one

pIndex

returned index of socket pool

cornerIp

only used for receiving

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

5.28.2.18

trdp_resetSequenceCounter()

void trdp_resetSequenceCounter (
PD_ELE_T ∗ pElement,
TRDP_IP_ADDR_T srcIP,
TRDP_MSG_T msgType )

remove the sequence counter for the comID/source IP.
The sequence counter should be reset if there was a packet time out.
Parameters
in pElement

in
in

srcIP
msgType

Generated by Doxygen

subscription element
Source IP address
message type

276

File Documentation

Return values
none

5.28.2.19

trdp_validTopoCounters()

BOOL8 trdp_validTopoCounters (
UINT32
UINT32
UINT32
UINT32

etbTopoCnt,
opTrnTopoCnt,
etbTopoCntFilter,
opTrnTopoCntFilter )

Check topography counters The applied conformance pattern follows Table A.5/A.21 (positive match): Telegram to
be sent Locally stored value (appSession) Case etbTopoCnt opTrnTopoCnt etbTopoCntFilter opTrnTopoCntFilter 1
any any 0 0 2 any equal 0 equal 3 equal any equal 0 4 equal equal equal equal.
Parameters
in etbTopoCnt

in
in
in

ETB topography counter to be checked

opTrnTopoCnt

Operational topography counter to be checked

etbTopoCntFilter

ETB topography counter filter value

opTrnTopoCntFilter

Operational topography counter filter value

Return values
TRUE Filter criteria matched FALSE Filter criteria not matched

5.29

trdp_utils.h File Reference

Common utilities for TRDP communication.

#include
#include
#include
#include


"trdp_private.h"
"vos_utils.h"
"vos_sock.h"
Generated by Doxygen

5.29 trdp_utils.h File Reference

277

Include dependency graph for trdp_utils.h:

trdp_utils.h

trdp_private.h

vos_utils.h

trdp_types.h

vos_mem.h

stdio.h

iec61375-2-3.h

stddef.h

vos_sock.h

vos_thread.h

vos_private.h

vos_types.h

stdint.h

This graph shows which files directly or indirectly include this file:

trdp_utils.h

tau_ctrl.c

tau_dnr.c

tau_marshall.c

tau_tti.c

tau_xml.c

trdp_if.c

trdp_mdcom.c

trdp_pdcom.c

trdp_utils.c

Functions
• PD_ELE_T ∗ trdp_queueFindComId (PD_ELE_T ∗pHead, UINT32 comId)
Return the element with same comId.

• PD_ELE_T ∗ trdp_queueFindSubAddr (PD_ELE_T ∗pHead, TRDP_ADDRESSES_T ∗pAddr)
Return the element with same comId and IP addresses.

• PD_ELE_T ∗ trdp_queueFindPubAddr (PD_ELE_T ∗pHead, TRDP_ADDRESSES_T ∗addr)
Return the element with same comId and IP addresses.

• void trdp_queueDelElement (PD_ELE_T ∗∗pHead, PD_ELE_T ∗pDelete)
Delete an element.

• void trdp_queueAppLast (PD_ELE_T ∗∗pHead, PD_ELE_T ∗pNew)
Append an element at end of queue.

• void trdp_queueInsFirst (PD_ELE_T ∗∗pHead, PD_ELE_T ∗pNew)
Insert an element at front of queue.

• INT32 trdp_getCurrentMaxSocketCnt (void)
Generated by Doxygen

278

File Documentation

Return the largest number of the socket index.

• void trdp_initSockets (TRDP_SOCKETS_T iface[ ])
Handle the socket pool: Initialize it.

• void trdp_initUncompletedTCP (TRDP_APP_SESSION_T appHandle)
???

• void trdp_resetSequenceCounter (PD_ELE_T ∗pElement, TRDP_IP_ADDR_T srcIP, TRDP_MSG_T msg←Type)
remove the sequence counter for the comID/source IP.

• TRDP_IP_ADDR_T trdp_findMCjoins (TRDP_APP_SESSION_T appHandle, TRDP_IP_ADDR_T mcGroup)
Check an MC group not used by other sockets / subscribers/ listeners.

• TRDP_ERR_T trdp_requestSocket (TRDP_SOCKETS_T iface[ ], UINT16 port, const TRDP_SEND_PA←RAM_T ∗params, TRDP_IP_ADDR_T srcIP, TRDP_IP_ADDR_T mcGroup, TRDP_SOCK_TYPE_T type,
TRDP_OPTION_T options, BOOL8 rcvMostly, SOCKET useSocket, INT32 ∗pIndex, TRDP_IP_ADDR_←T cornerIp)
Handle the socket pool: Request a socket from our socket pool First we loop through the socket pool and check if
there is already a socket which would suit us.

• void trdp_releaseSocket (TRDP_SOCKETS_T iface[ ], INT32 lIndex, UINT32 connectTimeout, BOOL8
checkAll, TRDP_IP_ADDR_T mcGroupUsed)
Handle the socket pool: Release a socket from our socket pool.

• UINT32 trdp_packetSizePD (UINT32 dataSize)
Get the packet size from the raw data size.

• UINT32 trdp_packetSizeMD (UINT32 dataSize)
Get the packet size from the raw data size.

• UINT32 trdp_getSeqCnt (UINT32 comID, TRDP_MSG_T msgType, TRDP_IP_ADDR_T srcIP)
Get the initial sequence counter for the comID/message type and subnet (source IP).

• int trdp_checkSequenceCounter (PD_ELE_T ∗pElement, UINT32 sequenceCounter, TRDP_IP_ADDR_←T srcIP, TRDP_MSG_T msgType)
check and update the sequence counter for the comID/source IP.

• BOOL8 trdp_isAddressed (const TRDP_URI_USER_T listUri, const TRDP_URI_USER_T destUri)
Check if listener URI is in addressing range of destination URI.

• BOOL8 trdp_validTopoCounters (UINT32 etbTopoCnt, UINT32 opTrnTopoCnt, UINT32 etbTopoCntFilter, U←INT32 opTrnTopoCntFilter)
Check topography counters The applied conformance pattern follows Table A.5/A.21 (positive match): Telegram to be
sent Locally stored value (appSession) Case etbTopoCnt opTrnTopoCnt etbTopoCntFilter opTrnTopoCntFilter 1 any
any 0 0 2 any equal 0 equal 3 equal any equal 0 4 equal equal equal equal.

• BOOL8 trdp_isInIPrange (TRDP_IP_ADDR_T receivedSrcIP, TRDP_IP_ADDR_T listenedSourceIPlow, T←RDP_IP_ADDR_T listenedSourceIPhigh)
Check if received IP is in addressing range of listener's IPs.

5.29.1

Detailed Description

Common utilities for TRDP communication.
Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH

Generated by Doxygen

5.29 trdp_utils.h File Reference

279

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.

Id
trdp_utils.h 1779 2018-11-07 09:49:55Z bloehr

BL
BL
BL
BL
BL

2018-06-20:
2017-11-28:
2017-11-15:
2017-05-08:
2016-07-06:

Ticket #184: Building with VS 2015: WIN64 and Windows threads (SOCKET instead of INT32)
Ticket #180 Filtering rules for DestinationURI does not follow the standard
Ticket #1
Unjoin on unsubscribe/delListener (finally ;-)
Doxygen comment errors
Ticket #122 64Bit compatibility (+ compiler warnings)

5.29.2

Function Documentation

5.29.2.1

trdp_checkSequenceCounter()

int trdp_checkSequenceCounter (
PD_ELE_T ∗ pElement,
UINT32 sequenceCounter,
TRDP_IP_ADDR_T srcIP,
TRDP_MSG_T msgType )

check and update the sequence counter for the comID/source IP.
If the comID/srcIP is not found, update it and return 0 - else if already received, return 1 On memory error, return -1
Parameters
in pElement

in
in
in

subscription element

sequenceCounter

sequence counter to check

srcIP
msgType

Source IP address
type of the message

Return values
0 - no duplicate 1 - duplicate sequence counter -1 - memory error

If the comID/srcIP is not found, update it and return 0 - else if already received, return 1 On memory error, return -1
Parameters
in pElement

in
in
in

subscription element

sequenceCounter

sequence counter to check

srcIP
msgType

Source IP address
type of the message

Generated by Doxygen

280

File Documentation

Return values
0 - no duplicate 1 - duplicate or old sequence counter -1 - memory error

Here is the call graph for this function:

vos_memAlloc

trdp_checkSequenceCounter

vos_ipDotted

vos_memFree

5.29.2.2

trdp_findMCjoins()

TRDP_IP_ADDR_T trdp_findMCjoins (
TRDP_APP_SESSION_T appHandle,
TRDP_IP_ADDR_T mcGroup )

Check an MC group not used by other sockets / subscribers/ listeners.
Parameters
in appHandle

in

mcGroup

the handle returned by tlc_openSession
multicast group to look for

Return values
multi cast group if unused VOS_INADDR_ANY if used

5.29.2.3

trdp_getCurrentMaxSocketCnt()

INT32 trdp_getCurrentMaxSocketCnt (
void )

Return the largest number of the socket index.

Generated by Doxygen

5.29 trdp_utils.h File Reference

281

Returns
maxSocketCount

5.29.2.4

trdp_getSeqCnt()

UINT32 trdp_getSeqCnt (
UINT32 comId,
TRDP_MSG_T msgType,
TRDP_IP_ADDR_T srcIpAddr )

Get the initial sequence counter for the comID/message type and subnet (source IP).
If the comID/srcIP is not found elsewhere, return 0 - else return its current sequence number (the redundant packet
needs the same seqNo)
Note: The standard demands that sequenceCounter is managed per comID/msgType at each publisher, but shall
be the same for redundant telegrams (subnet/srcIP).
Parameters
in comID
in msgType

in

srcIP

comID to look for
PD/MD type
Source IP address

Return values
return the sequence number

If the comID/srcIP is not found elsewhere, return 0 - else return its current sequence number (the redundant packet
needs the same seqNo)
Note: The standard demands that sequenceCounter is managed per comID/msgType at each publisher, but shall
be the same for redundant telegrams (subnet/srcIP).
Parameters
in comId
in msgType

in

srcIpAddr

comID to look for
PD/MD type
Source IP address

Return values
return the sequence number

5.29.2.5

trdp_initSockets()

void trdp_initSockets (
Generated by Doxygen

282

File Documentation

TRDP_SOCKETS_T iface[ ] )

Handle the socket pool: Initialize it.
Parameters
in iface

5.29.2.6

pointer to the socket pool

trdp_initUncompletedTCP()

void trdp_initUncompletedTCP (
TRDP_APP_SESSION_T appHandle )

???
Parameters
in appHandle

5.29.2.7

session handle

trdp_isAddressed()

BOOL8 trdp_isAddressed (
const TRDP_URI_USER_T listUri,
const TRDP_URI_USER_T destUri )

Check if listener URI is in addressing range of destination URI.
Parameters
in listUri

in

destUri

Null terminated listener URI string to compare
Null terminated destination URI string to compare

Return values
FALSE - not in addressing range
TRUE

5.29.2.8

- listener URI is in addressing range of destination URI

trdp_isInIPrange()

BOOL8 trdp_isInIPrange (
TRDP_IP_ADDR_T receivedSrcIP,
TRDP_IP_ADDR_T listenedSourceIPlow,
TRDP_IP_ADDR_T listenedSourceIPhigh )
Generated by Doxygen

5.29 trdp_utils.h File Reference

Check if received IP is in addressing range of listener's IPs.

Generated by Doxygen

283

284

File Documentation

Parameters
in receivedSrcIP
in listenedSourceIPlow
in listenedSourceIPhigh

Received IP address
Lower bound IP
Upper bound IP

Return values
FALSE - not in addressing range
TRUE

5.29.2.9

- received IP is in addressing range of listener

trdp_packetSizeMD()

UINT32 trdp_packetSizeMD (
UINT32 dataSize )

Get the packet size from the raw data size.
Parameters
in dataSize

net data size

Return values
packet size the size of the complete packet to be sent or received

Parameters
in dataSize

net data size (without padding)

Return values
packet size the size of the complete packet to be sent or received

5.29.2.10

trdp_packetSizePD()

UINT32 trdp_packetSizePD (
UINT32 dataSize )

Get the packet size from the raw data size.
Parameters
in dataSize

net data size

Generated by Doxygen

5.29 trdp_utils.h File Reference
Return values
packet size the size of the complete packet to be sent or received

Parameters
in dataSize

net data size (without padding)

Return values
packet size the size of the complete packet to be sent or received

5.29.2.11

trdp_queueAppLast()

void trdp_queueAppLast (
PD_ELE_T ∗∗ ppHead,
PD_ELE_T ∗ pNew )

Append an element at end of queue.
Parameters
in ppHead

in

5.29.2.12

pNew

pointer to pointer to head of queue
pointer to element to append

trdp_queueDelElement()

void trdp_queueDelElement (
PD_ELE_T ∗∗ ppHead,
PD_ELE_T ∗ pDelete )

Delete an element.
Parameters
in ppHead

in

5.29.2.13

pDelete

pointer to pointer to head of queue
pointer to element to delete

trdp_queueFindComId()

PD_ELE_T∗ trdp_queueFindComId (
PD_ELE_T ∗ pHead,
UINT32 comId )
Generated by Doxygen

285

286

File Documentation

Return the element with same comId.
Parameters
in pHead

in

comId

pointer to head of queue
ComID to search for

Return values
!= NULL pointer to PD element
NULL

No PD element found

5.29.2.14

trdp_queueFindPubAddr()

PD_ELE_T∗ trdp_queueFindPubAddr (
PD_ELE_T ∗ pHead,
TRDP_ADDRESSES_T ∗ addr )

Return the element with same comId and IP addresses.
Parameters
in pHead

in

addr

pointer to head of queue
Pub/Sub handle (Address, ComID, srcIP & dest IP) to search for

Return values
!= NULL pointer to PD element
NULL

No PD element found

5.29.2.15

trdp_queueFindSubAddr()

PD_ELE_T∗ trdp_queueFindSubAddr (
PD_ELE_T ∗ pHead,
TRDP_ADDRESSES_T ∗ addr )

Return the element with same comId and IP addresses.
Parameters
in pHead

in

addr

pointer to head of queue
Pub/Sub handle (Address, ComID, srcIP & dest IP) to search for

Return values
!= NULL pointer to PD element

Generated by Doxygen

5.29 trdp_utils.h File Reference
Return values
NULL No PD element found

5.29.2.16

trdp_queueInsFirst()

void trdp_queueInsFirst (
PD_ELE_T ∗∗ ppHead,
PD_ELE_T ∗ pNew )

Insert an element at front of queue.
Parameters
in ppHead

in

5.29.2.17

pNew

pointer to pointer to head of queue
pointer to element to insert

trdp_releaseSocket()

void trdp_releaseSocket (
TRDP_SOCKETS_T iface[ ],
INT32 lIndex,
UINT32 connectTimeout,
BOOL8 checkAll,
TRDP_IP_ADDR_T mcGroupUsed )

Handle the socket pool: Release a socket from our socket pool.
Parameters

in,out
in
in
in
in

iface

socket pool

lIndex
connectTimeout
checkAll

index of socket to release
timeout value
release all TCP pending sockets

mcGroupUsed

release MC group subscription

Handle the socket pool: Release a socket from our socket pool.
In Udp, Release a socket from our socket pool
Parameters

in,out
in
in
in
in

iface

socket pool

lIndex
connectTimeout
checkAll

index of socket to release
time out
release all TCP pending sockets

mcGroupUsed

release MC group subscription

Generated by Doxygen

287

288

5.29.2.18

File Documentation

trdp_requestSocket()

TRDP_ERR_T trdp_requestSocket (
TRDP_SOCKETS_T iface[ ],
UINT16 port,
const TRDP_SEND_PARAM_T ∗ params,
TRDP_IP_ADDR_T srcIP,
TRDP_IP_ADDR_T mcGroup,
TRDP_SOCK_TYPE_T type,
TRDP_OPTION_T options,
BOOL8 rcvMostly,
SOCKET useSocket,
INT32 ∗ pIndex,
TRDP_IP_ADDR_T cornerIp )

Handle the socket pool: Request a socket from our socket pool First we loop through the socket pool and check if
there is already a socket which would suit us.
If a multicast group should be joined, we do that on an otherwise suitable socket - up to 20 multicast goups can
be joined per socket. If a socket for multicast publishing is requested, we also use the source IP to determine the
interface for outgoing multicast traffic.
Parameters

in,out
in
in
in
in
in
in
in
out
out
in

iface

socket pool

port

port to use

params

parameters to use

srcIP

IP to bind to (0 = any address)

mcGroup

MC group to join (0 = do not join)

type

type determines port to bind to (PD, MD/UDP, MD/TCP)

options

blocking/nonblocking

rcvMostly

only used for receiving

useSocket

socket to use, do not open a new one

pIndex

returned index of socket pool

cornerIp

only used for receiving

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

If a multicast group should be joined, we do that on an otherwise suitable socket - up to
20 multicast goups can be joined per socket. If a socket for multicast publishing is
requested, we also use the source IP to determine the interface for outgoing multicast
traffic.

Parameters

in,out
in
in
in
in

iface

socket pool

port

port to use

params

parameters to use

srcIP

IP to bind to (0 = any address)

mcGroup

MC group to join (0 = do not join)
Generated by Doxygen

5.29 trdp_utils.h File Reference

289

Parameters

in
in
in
out
out
in

type

type determines port to bind to (PD, MD/UDP, MD/TCP)

options

blocking/nonblocking

rcvMostly

primarily used for receiving (tbd: bind on sender, too?)

useSocket

socket to use, do not open a new one

pIndex

returned index of socket pool

cornerIp

only used for receiving

Return values
TRDP_NO_ERR
TRDP_PARAM_ERR

5.29.2.19

trdp_resetSequenceCounter()

void trdp_resetSequenceCounter (
PD_ELE_T ∗ pElement,
TRDP_IP_ADDR_T srcIP,
TRDP_MSG_T msgType )

remove the sequence counter for the comID/source IP.
The sequence counter should be reset if there was a packet time out.
Parameters
in pElement

in
in

srcIP
msgType

subscription element
Source IP address
message type

Return values
none

5.29.2.20

trdp_validTopoCounters()

BOOL8 trdp_validTopoCounters (
UINT32 etbTopoCnt,
UINT32 opTrnTopoCnt,
UINT32 etbTopoCntFilter,
UINT32 opTrnTopoCntFilter )

Check topography counters The applied conformance pattern follows Table A.5/A.21 (positive match): Telegram to
be sent Locally stored value (appSession) Case etbTopoCnt opTrnTopoCnt etbTopoCntFilter opTrnTopoCntFilter 1
any any 0 0 2 any equal 0 equal 3 equal any equal 0 4 equal equal equal equal.

Generated by Doxygen

290

File Documentation

Parameters
in etbTopoCnt

in
in
in

ETB topography counter to be checked

opTrnTopoCnt

Operational topography counter to be checked

etbTopoCntFilter

ETB topography counter filter value

opTrnTopoCntFilter

Operational topography counter filter value

Return values
TRUE Filter criteria matched FALSE Filter criteria not matched

5.30

trdp_xml.c File Reference

Simple XML parser.

#include
#include
#include
#include
#include





"trdp_xml.h"

Include dependency graph for trdp_xml.c:

trdp_xml.c

trdp_xml.h

stdlib.h

string.h

vos_utils.h

stdio.h

sys/types.h

trdp_private.h

stddef.h

trdp_types.h

vos_sock.h

vos_mem.h

vos_private.h

iec61375-2-3.h

vos_thread.h

vos_types.h

stdint.h

Functions
• TRDP_ERR_T trdp_XMLOpen (XML_HANDLE_T ∗pXML, const char ∗file)
Opens the XML parsing.

Generated by Doxygen

5.30 trdp_xml.c File Reference

291

• void trdp_XMLRewind (XML_HANDLE_T ∗pXML)
Rewind to start.

• void trdp_XMLClose (XML_HANDLE_T ∗pXML)
Closes the XML parsng.

• int trdp_XMLSeekStartTagAny (XML_HANDLE_T ∗pXML, char ∗tag, int maxlen)
Seek next tag on starting depth and return it in provided buffer.

• int trdp_XMLSeekStartTag (XML_HANDLE_T ∗pXML, const char ∗tag)
Seek a specific tag.

• int trdp_XMLCountStartTag (XML_HANDLE_T ∗pXML, const char ∗tag)
Count a specific tag.

• void trdp_XMLEnter (XML_HANDLE_T ∗pXML)
Enter level in XML file.

• void trdp_XMLLeave (XML_HANDLE_T ∗pXML)
Leave level in XML file.

• XML_TOKEN_T trdp_XMLGetAttribute (XML_HANDLE_T ∗pXML, CHAR8 ∗attribute, UINT32 ∗pValueInt,
CHAR8 ∗value)
Get value of next attribute, as string and if possible as integer.

5.30.1

Detailed Description

Simple XML parser.
Hint: Missing optional elements must be handled using the count-function, otherwise following elements will be
following ignored!
Note
Project: TCNOpen TRDP prototype stack
Author
Bernd Loehr, NewTec GmbH; based on code by Peter Brander, Bombardier
Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was
not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
Id
trdp_xml.c 1778 2018-11-07 08:31:57Z s-bender
SB
BL
BL
BL

2018-11-07:
2016-07-06:
2016-02-24:
2016-02-11:

Ticket #221 readXmlDatasets failed
Ticket #122 64Bit compatibility (+ compiler warnings)
missing include (thanks to Robert)
Ticket #102: Replacing libxml2

5.30.2

Function Documentation

5.30.2.1

trdp_XMLClose()

void trdp_XMLClose (
XML_HANDLE_T ∗ pXML )

Closes the XML parsng.

Generated by Doxygen

292

File Documentation

Parameters
in pXML

Pointer to local data

Return values
none

5.30.2.2

trdp_XMLCountStartTag()

int trdp_XMLCountStartTag (
XML_HANDLE_T ∗ pXML,
const char ∗ tag )

Count a specific tag.
Parameters
in pXML

in

tag

Pointer to local data
Tag to count

Return values
0 if found !=0 if not found

5.30.2.3

trdp_XMLEnter()

void trdp_XMLEnter (
XML_HANDLE_T ∗ pXML )

Enter level in XML file.
Parameters
in pXML

Pointer to local data

Return values
none

5.30.2.4

trdp_XMLGetAttribute()

XML_TOKEN_T trdp_XMLGetAttribute (
Generated by Doxygen

5.30 trdp_xml.c File Reference

XML_HANDLE_T ∗ pXML,
CHAR8 ∗ attribute,
UINT32 ∗ pValueInt,
CHAR8 ∗ value )

Get value of next attribute, as string and if possible as integer.
Parameters
in
pXML

in
out
out

Pointer to local data

attribute
pValueInt

Pointer to attribute
Pointer to resulting integer value

value

Pointer to resulting string value

Return values
TOK_ATTRIBUTE

5.30.2.5

if found token if not found

trdp_XMLLeave()

void trdp_XMLLeave (
XML_HANDLE_T ∗ pXML )

Leave level in XML file.
Parameters
in pXML

Pointer to local data

Return values
none

5.30.2.6

trdp_XMLOpen()

TRDP_ERR_T trdp_XMLOpen (
XML_HANDLE_T ∗ pXML,
const char ∗ file )

Opens the XML parsing.
Parameters
in pXML

in

file

Pointer to local data
Pathname of XML file

Generated by Doxygen

293

294

File Documentation

Return values
none

5.30.2.7

trdp_XMLRewind()

void trdp_XMLRewind (
XML_HANDLE_T ∗ pXML )

Rewind to start.
Parameters
in pXML

Pointer to local data

Return values
none

5.30.2.8

trdp_XMLSeekStartTag()

int trdp_XMLSeekStartTag (
XML_HANDLE_T ∗ pXML,
const char ∗ tag )

Seek a specific tag.
Parameters
in pXML

in

tag

Pointer to local data
Tag to be found

Return values
0 if found !=0 if not found

5.30.2.9

trdp_XMLSeekStartTagAny()

int trdp_XMLSeekStartTagAny (
XML_HANDLE_T ∗ pXML,
char ∗ tag,
int maxlen )
Generated by Doxygen

5.31 trdp_xml.h File Reference

295

Seek next tag on starting depth and return it in provided buffer.
Start tags on deeper depths are ignored.
Parameters

in
in,out
in

pXML

Pointer to local data

tag

Buffer for found tag

maxlen

Length of buffer

Return values
0 if found !=0 if not found

5.31

trdp_xml.h File Reference

Simple XML parser.

#include 
#include "trdp_private.h"
#include "vos_utils.h"
Include dependency graph for trdp_xml.h:

trdp_xml.h

trdp_private.h

trdp_types.h

vos_mem.h

iec61375-2-3.h

vos_thread.h

vos_private.h

vos_types.h

stdint.h

Generated by Doxygen

vos_utils.h

stdio.h

vos_sock.h

stddef.h

296

File Documentation

This graph shows which files directly or indirectly include this file:

trdp_xml.h

tau_xml.c

trdp_xml.c

Functions
• TRDP_ERR_T trdp_XMLOpen (XML_HANDLE_T ∗pXML, const char ∗file)
Opens the XML parsing.

• void trdp_XMLClose (XML_HANDLE_T ∗pXML)
Closes the XML parsng.

• int trdp_XMLCountStartTag (XML_HANDLE_T ∗pXML, const char ∗tag)
Count a specific tag.

• int trdp_XMLSeekStartTagAny (XML_HANDLE_T ∗pXML, char ∗tag, int maxlen)
Seek next tag on starting depth and return it in provided buffer.

• int trdp_XMLSeekStartTag (XML_HANDLE_T ∗pXML, const char ∗tag)
Seek a specific tag.

• XML_TOKEN_T trdp_XMLGetAttribute (XML_HANDLE_T ∗pXML, CHAR8 ∗attribute, UINT32 ∗pValueInt,
CHAR8 ∗value)
Get value of next attribute, as string and if possible as integer.

• void trdp_XMLRewind (XML_HANDLE_T ∗pXML)
Rewind to start.

• void trdp_XMLEnter (XML_HANDLE_T ∗pXML)
Enter level in XML file.

• void trdp_XMLLeave (XML_HANDLE_T ∗pXML)
Leave level in XML file.

5.31.1

Detailed Description

Simple XML parser.

Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH

Generated by Doxygen

5.31 trdp_xml.h File Reference

297

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
NewTec GmbH or its subsidiaries and others, 2016. All rights reserved.

Id
trdp_xml.h 1581 2017-02-08 17:39:38Z bloehr

BL 2016-02-11: Ticket #102: Replacing libxml2

5.31.2

Function Documentation

5.31.2.1

trdp_XMLClose()

void trdp_XMLClose (
XML_HANDLE_T ∗ pXML )

Closes the XML parsng.
Parameters
in pXML

Pointer to local data

Return values
none

5.31.2.2

trdp_XMLCountStartTag()

int trdp_XMLCountStartTag (
XML_HANDLE_T ∗ pXML,
const char ∗ tag )

Count a specific tag.
Parameters
in pXML

in

tag

Pointer to local data
Tag to count

Return values
0 if found !=0 if not found

Generated by Doxygen

298

5.31.2.3

File Documentation

trdp_XMLEnter()

void trdp_XMLEnter (
XML_HANDLE_T ∗ pXML )

Enter level in XML file.
Parameters
in pXML

Pointer to local data

Return values
none

5.31.2.4

trdp_XMLGetAttribute()

XML_TOKEN_T trdp_XMLGetAttribute (
XML_HANDLE_T ∗ pXML,
CHAR8 ∗ attribute,
UINT32 ∗ pValueInt,
CHAR8 ∗ value )

Get value of next attribute, as string and if possible as integer.
Parameters
in
pXML

in
out
out

Pointer to local data

attribute
pValueInt

Pointer to attribute
Pointer to resulting integer value

value

Pointer to resulting string value

Return values
TOK_ATTRIBUTE

5.31.2.5

if found token if not found

trdp_XMLLeave()

void trdp_XMLLeave (
XML_HANDLE_T ∗ pXML )

Leave level in XML file.

Generated by Doxygen

5.31 trdp_xml.h File Reference
Parameters
in pXML

Pointer to local data

Return values
none

5.31.2.6

trdp_XMLOpen()

TRDP_ERR_T trdp_XMLOpen (
XML_HANDLE_T ∗ pXML,
const char ∗ file )

Opens the XML parsing.
Parameters
in pXML

in

file

Pointer to local data
Pathname of XML file

Return values
none

5.31.2.7

trdp_XMLRewind()

void trdp_XMLRewind (
XML_HANDLE_T ∗ pXML )

Rewind to start.
Parameters
in pXML

Pointer to local data

Return values
none

5.31.2.8

trdp_XMLSeekStartTag()

int trdp_XMLSeekStartTag (
Generated by Doxygen

299

300

File Documentation

XML_HANDLE_T ∗ pXML,
const char ∗ tag )

Seek a specific tag.
Parameters
in pXML

in

tag

Pointer to local data
Tag to be found

Return values
0 if found !=0 if not found

5.31.2.9

trdp_XMLSeekStartTagAny()

int trdp_XMLSeekStartTagAny (
XML_HANDLE_T ∗ pXML,
char ∗ tag,
int maxlen )

Seek next tag on starting depth and return it in provided buffer.
Start tags on deeper depths are ignored.
Parameters

in
in,out
in

pXML

Pointer to local data

tag

Buffer for found tag

maxlen

Length of buffer

Return values
0 if found !=0 if not found

5.32

vos_mem.c File Reference

Memory functions.

#include
#include
#include
#include
#include
#include
#include
#include







"vos_types.h"
"vos_utils.h"
Generated by Doxygen

5.32 vos_mem.c File Reference

301

#include "vos_mem.h"
#include "vos_thread.h"
#include "vos_private.h"
Include dependency graph for vos_mem.c:

vos_mem.c

vos_utils.h

stdlib.h

errno.h

stdio.h

string.h

stddef.h

vos_mem.h

vos_private.h

vos_thread.h

vos_types.h

stdint.h

Functions
• EXT_DECL VOS_ERR_T vos_memInit (UINT8 ∗pMemoryArea, UINT32 size, const UINT32 fragMem[VO←S_MEM_NBLOCKSIZES])
Initialize the memory unit.

• EXT_DECL void vos_memDelete (UINT8 ∗pMemoryArea)
Delete the memory area.

• EXT_DECL UINT8 ∗ vos_memAlloc (UINT32 size)
Allocate a block of memory (from memory area above).

• EXT_DECL void vos_memFree (void ∗pMemBlock)
Deallocate a block of memory (from memory area above).

• EXT_DECL VOS_ERR_T vos_memCount (UINT32 ∗pAllocatedMemory, UINT32 ∗pFreeMemory, UINT32
∗pMinFree, UINT32 ∗pNumAllocBlocks, UINT32 ∗pNumAllocErr, UINT32 ∗pNumFreeErr, UINT32 block←Size[VOS_MEM_NBLOCKSIZES], UINT32 usedBlockSize[VOS_MEM_NBLOCKSIZES])
Return used and available memory (of memory area above).

• EXT_DECL void vos_qsort (void ∗pBuf, UINT32 num, UINT32 size, int(∗compare)(const void ∗, const void
∗))
Sort an array.

• EXT_DECL void ∗ vos_bsearch (const void ∗pKey, const void ∗pBuf, UINT32 num, UINT32 size,
int(∗compare)(const void ∗, const void ∗))
Binary search in a sorted array.

• EXT_DECL INT32 vos_strnicmp (const CHAR8 ∗pStr1, const CHAR8 ∗pStr2, UINT32 count)
Case insensitive string compare.

• EXT_DECL void vos_strncpy (CHAR8 ∗pStrDst, const CHAR8 ∗pStrSrc, UINT32 count)
String copy with length limitation.

• EXT_DECL void vos_strncat (CHAR8 ∗pStrDst, UINT32 count, const CHAR8 ∗pStrSrc)
String concatenation with length limitation.

• EXT_DECL VOS_ERR_T vos_queueCreate (VOS_QUEUE_POLICY_T queueType, UINT32 maxNoOfMsg,
VOS_QUEUE_T ∗pQueueHandle)
Initialize a message queue.

• EXT_DECL VOS_ERR_T vos_queueSend (VOS_QUEUE_T queueHandle, UINT8 ∗pData, UINT32 size)
Send a message.

Generated by Doxygen

302

File Documentation
• EXT_DECL VOS_ERR_T vos_queueReceive (VOS_QUEUE_T queueHandle, UINT8 ∗∗ppData, UINT32
∗pSize, UINT32 usTimeout)
Get a message.

• EXT_DECL VOS_ERR_T vos_queueDestroy (VOS_QUEUE_T queueHandle)
Destroy a message queue.

5.32.1

Detailed Description

Memory functions.
OS abstraction of memory access and control
Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.
Id
vos_mem.c 1768 2018-10-25 09:59:45Z ahweiss

Changes: BL 2018-06-20: Ticket #184: Building with VS 2015: WIN64 and Windows threads (SOCKET instead
of INT32) BL 2016-07-06: Ticket #122 64Bit compatibility (+ compiler warnings) BL 2016-02-10: Debug print: tabs
before size output BL 2012-12-03: ID 1: "using uninitialized PD_ELE_T.pullIpAddress variable" ID 2: "uninitialized
PD_ELE_T newPD->pNext in tlp_subscribe()"

5.32.2

Function Documentation

5.32.2.1

vos_bsearch()

EXT_DECL void∗ vos_bsearch (
const void ∗ pKey,
const void ∗ pBuf,
UINT32 num,
UINT32 size,
int(∗)(const void ∗, const void ∗) compare )

Binary search in a sorted array.
This is just a wrapper for the standard bsearch function.

Generated by Doxygen

5.32 vos_mem.c File Reference
Parameters
in pKey

in
in
in
in

Key to search for

pBuf

Pointer to the array to search

num
size
compare

number of elements
size of one element
Pointer to compare function return -n if arg1 < arg2, return 0 if arg1 == arg2, return +n if arg1
> arg2 where n is an integer != 0

Return values
Pointer to found element or NULL

5.32.2.2

vos_memAlloc()

EXT_DECL UINT8∗ vos_memAlloc (
UINT32 size )

Allocate a block of memory (from memory area above).
Parameters
in size

Size of requested block

Return values
Pointer to memory area
NULL

5.32.2.3

303

if no memory available

vos_memCount()

EXT_DECL VOS_ERR_T vos_memCount (
UINT32 ∗ pAllocatedMemory,
UINT32 ∗ pFreeMemory,
UINT32
UINT32
UINT32
UINT32
UINT32

∗ pMinFree,
∗ pNumAllocBlocks,
∗ pNumAllocErr,
∗ pNumFreeErr,
blockSize[VOS_MEM_NBLOCKSIZES],

UINT32 usedBlockSize[VOS_MEM_NBLOCKSIZES] )

Return used and available memory (of memory area above).
Parameters
out pAllocatedMemory

Generated by Doxygen

Pointer to allocated memory size

304

File Documentation

Parameters
out pFreeMemory

out
out
out
out
out
out

pMinFree

Pointer to minimal free memory size in statistics interval

pNumAllocBlocks

Pointer to number of allocated memory blocks

pNumAllocErr

Pointer to number of allocation errors

pNumFreeErr

Pointer to number of free errors

blockSize

Pointer to list of memory block sizes

usedBlockSize

Pointer to list of used memoryblocks

Return values
VOS_NO_ERR
VOS_INIT_ERR

5.32.2.4

Pointer to free memory size

no error
module not initialised

vos_memDelete()

EXT_DECL void vos_memDelete (
UINT8 ∗ pMemoryArea )

Delete the memory area.
This will eventually invalidate any previously allocated memory blocks! It should be called last before the application
quits. No further access to the memory blocks is allowed after this call.
Parameters
in pMemoryArea

5.32.2.5

Pointer to memory area used

vos_memFree()

EXT_DECL void vos_memFree (
void ∗ pMemBlock )

Deallocate a block of memory (from memory area above).
Parameters
in pMemBlock

5.32.2.6

Pointer to memory block to be freed

vos_memInit()

EXT_DECL VOS_ERR_T vos_memInit (
Generated by Doxygen

5.32 vos_mem.c File Reference

305

UINT8 ∗ pMemoryArea,
UINT32 size,
const UINT32 fragMem[VOS_MEM_NBLOCKSIZES] )

Initialize the memory unit.
Init a supplied block of memory and prepare it for use with vos_memAlloc and vos_memFree. The used block
sizes can be supplied and will be preallocated. If half of the overall size of the requested memory area would be
pre-allocated, either by the default pre-allocation table or a provided one, no pre-allocation takes place.
Parameters
in pMemoryArea

in
in

size

Size of provided memory area

fragMem

Pointer to list of preallocated block sizes, used to fragment memory for large blocks

Return values
VOS_NO_ERR
VOS_PARAM_ERR
VOS_MEM_ERR
VOS_MUTEX_ERR

5.32.2.7

Pointer to memory area to use

no error
parameter out of range/invalid
no memory available
no mutex available

vos_qsort()

EXT_DECL void vos_qsort (
void ∗ pBuf,
UINT32 num,
UINT32 size,
int(∗)(const void ∗, const void ∗) compare )

Sort an array.
This is just a wrapper for the standard qsort function.
Parameters

in,out
in
in
in

pBuf

Pointer to the array to sort

num
size
compare

number of elements
size of one element
Pointer to compare function return -n if arg1 < arg2, return 0 if arg1 == arg2, return +n
if arg1 > arg2 where n is an integer != 0

Return values
none

Generated by Doxygen

306

File Documentation

5.32.2.8

vos_queueCreate()

EXT_DECL VOS_ERR_T vos_queueCreate (
VOS_QUEUE_POLICY_T queueType,
UINT32 maxNoOfMsg,
VOS_QUEUE_T ∗ pQueueHandle )

Initialize a message queue.
Returns a handle for further calls
Parameters
in
queueType

in
out

Define queue type (1 = FIFO, 2 = LIFO, 3 = PRIO)

maxNoOfMsg

Maximum number of messages

pQueueHandle

Handle of created queue

Return values
VOS_NO_ERR
VOS_INIT_ERR

no error
module not initialised

VOS_NOINIT_ERR

invalid handle

VOS_PARAM_ERR

parameter out of range/invalid

VOS_INIT_ERR
VOS_QUEUE_ERR

5.32.2.9

not supported
error creating queue

vos_queueDestroy()

EXT_DECL VOS_ERR_T vos_queueDestroy (
VOS_QUEUE_T queueHandle )

Destroy a message queue.
Free all resources used by this queue
Parameters
in queueHandle

Queue handle

Return values
VOS_NO_ERR

no error

VOS_INIT_ERR

module not initialised

VOS_NOINIT_ERR

invalid handle

VOS_PARAM_ERR

parameter out of range/invalid

Generated by Doxygen

5.32 vos_mem.c File Reference

5.32.2.10

vos_queueReceive()

EXT_DECL VOS_ERR_T vos_queueReceive (
VOS_QUEUE_T queueHandle,
UINT8 ∗∗ ppData,
UINT32 ∗ pSize,
UINT32 usTimeout )

Get a message.
Parameters
in
queueHandle

out
out
in

Queue handle

ppData

Pointer to data pointer to be received

pSize

Size of receive data

usTimeout

Maximum time to wait for a message (in usec)

Return values
VOSNO_ERR
VOS_INIT_ERR

no error
module not initialised

VOS_NOINIT_ERR

invalid handle

VOS_PARAM_ERR

parameter out of range/invalid

VOS_QUEUE_ERR

queue is empty

5.32.2.11

vos_queueSend()

EXT_DECL VOS_ERR_T vos_queueSend (
VOS_QUEUE_T queueHandle,
UINT8 ∗ pData,
UINT32 size )

Send a message.
Parameters
in queueHandle

in
in

Queue handle

pData

Pointer to data to be sent

size

Size of data to be sent

Return values
VOS_NO_ERR
VOS_INIT_ERR

no error
module not initialised

VOS_NOINIT_ERR

invalid handle

VOS_PARAM_ERR

parameter out of range/invalid

VOS_INIT_ERR
VOS_QUEUE_ERR

Generated by Doxygen

not supported
error creating queue

307

308

5.32.2.12

File Documentation

vos_strncat()

EXT_DECL void vos_strncat (
CHAR8 ∗ pStrDst,
UINT32 count,
const CHAR8 ∗ pStrSrc )

String concatenation with length limitation.
Parameters
in pStrDst

in
in

count
pStrSrc

Destination string
Size of destination buffer
Null terminated string to append

Return values
none

5.32.2.13

vos_strncpy()

EXT_DECL void vos_strncpy (
CHAR8 ∗ pStrDst,
const CHAR8 ∗ pStrSrc,
UINT32 count )

String copy with length limitation.
Parameters
in pStrDst

in
in

Destination string

pStrSrc

Null terminated string to copy

count

Maximum number of characters to copy

Return values
none

5.32.2.14

vos_strnicmp()

EXT_DECL INT32 vos_strnicmp (
const CHAR8 ∗ pStr1,
Generated by Doxygen

5.33 vos_mem.h File Reference

309

const CHAR8 ∗ pStr2,
UINT32 count )

Case insensitive string compare.
Parameters
in pStr1

Null terminated string to compare

pStr2

Null terminated string to compare

count

Maximum number of characters to compare

in
in

Return values
0 - equal

<0
>0

5.33

- string1 less than string 2
- string 1 greater than string 2

vos_mem.h File Reference

Memory and queue functions for OS abstraction.

#include "vos_types.h"
#include "vos_thread.h"
Include dependency graph for vos_mem.h:

vos_mem.h

vos_thread.h

vos_types.h

stdint.h

Generated by Doxygen

310

File Documentation

This graph shows which files directly or indirectly include this file:
vos_mem.h

trdp_types.h

tau_tti_types.h

tau_marshall.h

tau_dnr.h

tau_marshall.c

tau_dnr_types.h

tau_tti.h

tau_cstinfo.c

trdp_mdcom.h

tau_dnr.c

tau_ctrl_types.h

tau_tti.c

vos_shared_mem.h

trdp_if_light.h

tau_xml.h

trdp_utils.h

trdp_mdcom.c

trdp_if.h

trdp_utils.c

trdp_xml.h

tau_xml.c

vos_mem.c

vos_utils.c

trdp_private.h

trdp_xml.c

trdp_stats.h

trdp_stats.c

trdp_if.c

trdp_pdcom.h

trdp_pdcom.c

tau_ctrl.h

tau_ctrl.c

Macros
• #define VOS_MEM_MAX_PREALLOCATE 10u
Max blocks to pre-allocate.

• #define VOS_MEM_NBLOCKSIZES 15u
No of pre-defined block sizes.

• #define VOS_MEM_BLOCKSIZES
We internally allocate memory always by these block sizes.

• #define VOS_MEM_PREALLOCATE {0u, 0u, 0u, 0u, 0u, 0u, 0u, 4u, 0u, 0u, 0u, 0u, 0u, 0u, 0u}
Default pre-allocation of free memory blocks.

Typedefs
• typedef struct VOS_QUEUE ∗ VOS_QUEUE_T
Opaque queue define.

Enumerations
• enum VOS_QUEUE_POLICY_T
Queue policy matching pthread/Posix defines.

Functions
• EXT_DECL VOS_ERR_T vos_memInit (UINT8 ∗pMemoryArea, UINT32 size, const UINT32 fragMem[VO←S_MEM_NBLOCKSIZES])
Initialize the memory unit.

• EXT_DECL void vos_memDelete (UINT8 ∗pMemoryArea)
Delete the memory area.

• EXT_DECL UINT8 ∗ vos_memAlloc (UINT32 size)
Allocate a block of memory (from memory area above).

• EXT_DECL void vos_memFree (void ∗pMemBlock)
Deallocate a block of memory (from memory area above).

• EXT_DECL VOS_ERR_T vos_memCount (UINT32 ∗pAllocatedMemory, UINT32 ∗pFreeMemory, UINT32
∗pMinFree, UINT32 ∗pNumAllocBlocks, UINT32 ∗pNumAllocErr, UINT32 ∗pNumFreeErr, UINT32 block←Size[VOS_MEM_NBLOCKSIZES], UINT32 usedBlockSize[VOS_MEM_NBLOCKSIZES])
Return used and available memory (of memory area above).

• EXT_DECL void vos_qsort (void ∗pBuf, UINT32 num, UINT32 size, int(∗compare)(const void ∗, const void
∗))
Sort an array.

Generated by Doxygen

5.33 vos_mem.h File Reference

311

• EXT_DECL void ∗ vos_bsearch (const void ∗pKey, const void ∗pBuf, UINT32 num, UINT32 size,
int(∗compare)(const void ∗, const void ∗))
Binary search in a sorted array.

• EXT_DECL INT32 vos_strnicmp (const CHAR8 ∗pStr1, const CHAR8 ∗pStr2, UINT32 count)
Case insensitive string compare.

• EXT_DECL void vos_strncpy (CHAR8 ∗pStrDst, const CHAR8 ∗pStrSrc, UINT32 count)
String copy with length limitation.

• EXT_DECL void vos_strncat (CHAR8 ∗pStrDst, UINT32 count, const CHAR8 ∗pStrSrc)
String concatenation with length limitation.

• EXT_DECL VOS_ERR_T vos_queueCreate (VOS_QUEUE_POLICY_T queueType, UINT32 maxNoOfMsg,
VOS_QUEUE_T ∗pQueueHandle)
Initialize a message queue.

• EXT_DECL VOS_ERR_T vos_queueSend (VOS_QUEUE_T queueHandle, UINT8 ∗pData, UINT32 size)
Send a message.

• EXT_DECL VOS_ERR_T vos_queueReceive (VOS_QUEUE_T queueHandle, UINT8 ∗∗ppData, UINT32
∗pSize, UINT32 usTimeout)
Get a message.

• EXT_DECL VOS_ERR_T vos_queueDestroy (VOS_QUEUE_T queueHandle)
Destroy a message queue.

5.33.1

Detailed Description

Memory and queue functions for OS abstraction.
This module provides memory control supervison

Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH Peter Brander (Memory scheme)

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.

Id
vos_mem.h 1631 2017-05-31 12:03:26Z bloehr

BL 2017-05-08: Compiler warnings, doxygen comment errors

5.33.2

Macro Definition Documentation

Generated by Doxygen

312

5.33.2.1

File Documentation

VOS_MEM_BLOCKSIZES

#define VOS_MEM_BLOCKSIZES

Value:

{34u, 48u, 128u, 180u, 256u, 512u, 1024u, 1480u, 2048u, \
4096u, 11520u, 16384u, 32768u, 65536u, 131072u}

We internally allocate memory always by these block sizes.
The largest available block is 524288 Bytes, provided the overal size of the used memory allocation area is larger.

5.33.2.2

VOS_MEM_PREALLOCATE

#define VOS_MEM_PREALLOCATE {0u, 0u, 0u, 0u, 0u, 0u, 0u, 4u, 0u, 0u, 0u, 0u, 0u, 0u, 0u}

Default pre-allocation of free memory blocks.
To avoid problems with too many small blocks and no large one. Specify how many of each block size that should
be pre-allocated (and freed!) to pre-segment the memory area.

5.33.3

Function Documentation

5.33.3.1

vos_bsearch()

EXT_DECL void∗ vos_bsearch (
const void ∗ pKey,
const void ∗ pBuf,
UINT32 num,
UINT32 size,
int(∗)(const void ∗, const void ∗) compare )

Binary search in a sorted array.
This is just a wrapper for the standard bsearch function.
Parameters
in pKey

in
in
in
in

Key to search for

pBuf

Pointer to the array to search

num
size
compare

number of elements
size of one element
Pointer to compare function return -n if arg1 < arg2, return 0 if arg1 == arg2, return +n if arg1
> arg2 where n is an integer != 0

Generated by Doxygen

5.33 vos_mem.h File Reference
Return values
Pointer to found element or NULL

5.33.3.2

vos_memAlloc()

EXT_DECL UINT8∗ vos_memAlloc (
UINT32 size )

Allocate a block of memory (from memory area above).
Parameters
in size

Size of requested block

Return values
Pointer to memory area
NULL

5.33.3.3

if no memory available

vos_memCount()

EXT_DECL VOS_ERR_T vos_memCount (
UINT32
UINT32
UINT32
UINT32
UINT32
UINT32

∗
∗
∗
∗
∗
∗

pAllocatedMemory,
pFreeMemory,
pMinFree,
pNumAllocBlocks,
pNumAllocErr,
pNumFreeErr,

UINT32 blockSize[VOS_MEM_NBLOCKSIZES],
UINT32 usedBlockSize[VOS_MEM_NBLOCKSIZES] )

Return used and available memory (of memory area above).
Parameters
out pAllocatedMemory

out
out
out
out
out
out
out

Pointer to allocated memory size

pFreeMemory

Pointer to free memory size

pMinFree

Pointer to minimal free memory size in statistics interval

pNumAllocBlocks

Pointer to number of allocated memory blocks

pNumAllocErr

Pointer to number of allocation errors

pNumFreeErr

Pointer to number of free errors

blockSize

Pointer to list of memory block sizes

usedBlockSize

Pointer to list of used memoryblocks

Generated by Doxygen

313

314

File Documentation

Return values
VOS_NO_ERR
VOS_INIT_ERR

5.33.3.4

no error
module not initialised

vos_memDelete()

EXT_DECL void vos_memDelete (
UINT8 ∗ pMemoryArea )

Delete the memory area.
This will eventually invalidate any previously allocated memory blocks! It should be called last before the application
quits. No further access to the memory blocks is allowed after this call.
Parameters
in pMemoryArea

Pointer to memory area to use

This will eventually invalidate any previously allocated memory blocks! It should be called last before the application
quits. No further access to the memory blocks is allowed after this call.
Parameters
in pMemoryArea

5.33.3.5

Pointer to memory area used

vos_memFree()

EXT_DECL void vos_memFree (
void ∗ pMemBlock )

Deallocate a block of memory (from memory area above).
Parameters
in pMemBlock

5.33.3.6

Pointer to memory block to be freed

vos_memInit()

EXT_DECL VOS_ERR_T vos_memInit (
UINT8 ∗ pMemoryArea,
UINT32 size,
const UINT32 fragMem[VOS_MEM_NBLOCKSIZES] )
Generated by Doxygen

5.33 vos_mem.h File Reference

315

Initialize the memory unit.
Init a supplied block of memory and prepare it for use with vos_alloc and vos_dealloc. The used block sizes can be
supplied and will be preallocated.
Parameters
in pMemoryArea

in
in

Pointer to memory area to use

size

Size of provided memory area

fragMem

Pointer to list of preallocate block sizes, used to fragment memory for large blocks

Return values
VOS_NO_ERR
VOS_PARAM_ERR
VOS_MEM_ERR

no error
parameter out of range/invalid
no memory available

Init a supplied block of memory and prepare it for use with vos_memAlloc and vos_memFree. The used block
sizes can be supplied and will be preallocated. If half of the overall size of the requested memory area would be
pre-allocated, either by the default pre-allocation table or a provided one, no pre-allocation takes place.
Parameters
in pMemoryArea

in
in

Size of provided memory area

fragMem

Pointer to list of preallocated block sizes, used to fragment memory for large blocks

Return values
VOS_NO_ERR
VOS_PARAM_ERR
VOS_MEM_ERR
VOS_MUTEX_ERR

5.33.3.7

Pointer to memory area to use

size

no error
parameter out of range/invalid
no memory available
no mutex available

vos_qsort()

EXT_DECL void vos_qsort (
void ∗ pBuf,
UINT32 num,
UINT32 size,
int(∗)(const void ∗, const void ∗) compare )

Sort an array.
This is just a wrapper for the standard qsort function.
Parameters

in,out pBuf
in
num
in
size
Generated by Doxygen
in
compare

Pointer to the array to sort
number of elements
size of one element
Pointer to compare function return -n if arg1 < arg2, return 0 if arg1 == arg2, return +n
if arg1 > arg2 where n is an integer != 0

316

File Documentation

Return values
none

5.33.3.8

vos_queueCreate()

EXT_DECL VOS_ERR_T vos_queueCreate (
VOS_QUEUE_POLICY_T queueType,
UINT32 maxNoOfMsg,
VOS_QUEUE_T ∗ pQueueHandle )

Initialize a message queue.
Returns a handle for further calls
Parameters
in
queueType

in
out

Define queue type (1 = FIFO, 2 = LIFO, 3 = PRIO)

maxNoOfMsg

Maximum number of messages

pQueueHandle

Handle of created queue

Return values
VOS_NO_ERR
VOS_INIT_ERR

no error
module not initialised

VOS_NOINIT_ERR

invalid handle

VOS_PARAM_ERR

parameter out of range/invalid

VOS_INIT_ERR
VOS_QUEUE_ERR

5.33.3.9

not supported
error creating queue

vos_queueDestroy()

EXT_DECL VOS_ERR_T vos_queueDestroy (
VOS_QUEUE_T queueHandle )

Destroy a message queue.
Free all resources used by this queue
Parameters
in queueHandle

Queue handle

Return values
VOS_NO_ERR

no error

Generated by Doxygen

5.33 vos_mem.h File Reference
Return values
VOS_INIT_ERR

module not initialised

VOS_NOINIT_ERR

invalid handle

VOS_PARAM_ERR

parameter out of range/invalid

5.33.3.10

vos_queueReceive()

EXT_DECL VOS_ERR_T vos_queueReceive (
VOS_QUEUE_T queueHandle,
UINT8 ∗∗ ppData,
UINT32 ∗ pSize,
UINT32 usTimeout )

Get a message.
Parameters
in
queueHandle

out
out
in

Queue handle

ppData

Pointer to data pointer to be received

pSize

Size of receive data

usTimeout

Maximum time to wait for a message (in usec)

Return values
VOSNO_ERR
VOS_INIT_ERR

no error
module not initialised

VOS_NOINIT_ERR

invalid handle

VOS_PARAM_ERR

parameter out of range/invalid

VOS_QUEUE_ERR

queue is empty

5.33.3.11

vos_queueSend()

EXT_DECL VOS_ERR_T vos_queueSend (
VOS_QUEUE_T queueHandle,
UINT8 ∗ pData,
UINT32 size )

Send a message.
Parameters
in queueHandle

in
in

Queue handle

pData

Pointer to data to be sent

size

Size of data to be sent

Generated by Doxygen

317

318

File Documentation

Return values
VOS_NO_ERR
VOS_INIT_ERR

no error
module not initialised

VOS_NOINIT_ERR

invalid handle

VOS_PARAM_ERR

parameter out of range/invalid

VOS_INIT_ERR
VOS_QUEUE_ERR

5.33.3.12

not supported
error creating queue

vos_strncat()

EXT_DECL void vos_strncat (
CHAR8 ∗ pStrDst,
UINT32 count,
const CHAR8 ∗ pStrSrc )

String concatenation with length limitation.
Parameters
in pStrDst

in
in

count
pStrSrc

Destination string
Size of destination buffer
Null terminated string to append

Return values
none

5.33.3.13

vos_strncpy()

EXT_DECL void vos_strncpy (
CHAR8 ∗ pStrDst,
const CHAR8 ∗ pStrSrc,
UINT32 count )

String copy with length limitation.
Parameters
in pStrDst

in
in

Destination string

pStrSrc

Null terminated string to copy

count

Maximum number of characters to copy

Return values
none
Generated by Doxygen

5.34 vos_shared_mem.h File Reference

5.33.3.14

vos_strnicmp()

EXT_DECL INT32 vos_strnicmp (
const CHAR8 ∗ pStr1,
const CHAR8 ∗ pStr2,
UINT32 count )

Case insensitive string compare.
Parameters
in pStr1

Null terminated string to compare

pStr2

Null terminated string to compare

count

Maximum number of characters to compare

in
in

Return values
0 - equal

<0
>0

5.34

- string1 less than string 2
- string 1 greater than string 2

vos_shared_mem.h File Reference

Shared Memory functions for OS abstraction.

#include "vos_types.h"
#include "vos_mem.h"
#include "vos_private.h"
Generated by Doxygen

319

320

File Documentation

Include dependency graph for vos_shared_mem.h:

vos_shared_mem.h

vos_mem.h

vos_private.h

vos_thread.h

vos_types.h

stdint.h

Functions
• EXT_DECL VOS_ERR_T vos_sharedOpen (const CHAR8 ∗pKey, VOS_SHRD_T ∗pHandle, UINT8 ∗∗pp←MemoryArea, UINT32 ∗pSize)
Create a shared memory area or attach to existing one.

• EXT_DECL VOS_ERR_T vos_sharedClose (VOS_SHRD_T handle, const UINT8 ∗pMemoryArea)
Close connection to the shared memory area.

5.34.1

Detailed Description

Shared Memory functions for OS abstraction.
This module provides shared memory control supervison

Note
Project: TCNOpen TRDP prototype stack

Author
Kazumasa Aiba, TOSHIBA

Generated by Doxygen

5.34 vos_shared_mem.h File Reference

321

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
TOSHIBA, Japan, 2013.

Id
vos_mem.h 282 2013-01-11 07:08:44Z 97029

5.34.2

Function Documentation

5.34.2.1

vos_sharedClose()

EXT_DECL VOS_ERR_T vos_sharedClose (
VOS_SHRD_T handle,
const UINT8 ∗ pMemoryArea )

Close connection to the shared memory area.
If the area was created by the calling process, the area will be closed (freed). If the area was attached, it will be
detached. This function is not available in each target implementation.
Parameters
in handle
in pMemoryArea

Return values
VOS_NO_ERR
VOS_MEM_ERR

5.34.2.2

Returned handle
Pointer to memory area

no error
no memory available

vos_sharedOpen()

EXT_DECL VOS_ERR_T vos_sharedOpen (
const CHAR8 ∗ pKey,
VOS_SHRD_T ∗ pHandle,
UINT8 ∗∗ ppMemoryArea,
UINT32 ∗ pSize )

Create a shared memory area or attach to existing one.
The first call with the a specified key will create a shared memory area with the supplied size and will return a handle
and a pointer to that area. If the area already exists, the area will be opened. This function is not available in each
target implementation.

Generated by Doxygen

322

File Documentation

Parameters

in
out
out
in,out

pKey

Unique identifier (file name)

pHandle

Pointer to returned handle

ppMemoryArea

Pointer to pointer to memory area

pSize

Pointer to size of area to allocate, on return actual size after attach

Return values
VOS_NO_ERR

no error

VOS_MEM_ERR

5.35

no memory available

vos_sock.h File Reference

Typedefs for OS abstraction.

#include "vos_types.h"
#include "vos_private.h"
Include dependency graph for vos_sock.h:

vos_sock.h

vos_types.h

vos_private.h

stdint.h

This graph shows which files directly or indirectly include this file:

vos_sock.h

trdp_types.h

tau_tti_types.h

tau_tti.h

tau_ctrl_types.h

tau_ctrl.h

tau_dnr.h

tau_cstinfo.c

vos_utils.c

tau_dnr_types.h

tau_xml.h

trdp_if_light.h

tau_marshall.h

tau_dnr.c

trdp_private.h

trdp_xml.h

tau_marshall.c

tau_xml.c

trdp_utils.h

trdp_xml.c

trdp_mdcom.h

trdp_mdcom.c

trdp_if.h

trdp_utils.c

trdp_stats.h

trdp_stats.c

trdp_pdcom.c

trdp_pdcom.h

trdp_if.c

tau_tti.c

tau_ctrl.c

Generated by Doxygen

5.35 vos_sock.h File Reference

323

Data Structures
• struct VOS_SOCK_OPT_T
Common socket options.

Macros
• #define VOS_MAX_SOCKET_CNT 4
The maximum number of sockets influences memory usage; for small systems we should define a smaller set.

• #define VOS_MAX_MULTICAST_CNT 5
The maximum number of multicast groups one socket can join.

• #define VOS_TTL_MULTICAST 64
The maximum number of hops a multicast packet can take.

• #define VOS_MAX_IF_NAME_SIZE 16
The maximum number of IP interface adapters that can be handled by VOS.

• #define VOS_MAX_NUM_IF 8
The maximum number of unicast addresses that can be handled by VOS.

• #define VOS_MAX_NUM_UNICAST 10
The MAC size supported by VOS.

• #define VOS_MAC_SIZE 6
Size of socket send and receive buffer.

• #define VOS_INVALID_SOCKET -1
Invalid socket number.

Functions
• EXT_DECL UINT16 vos_htons (UINT16 val)
Byte swapping 2 Bytes.

• EXT_DECL UINT16 vos_ntohs (UINT16 val)
Byte swapping 2 Bytes.

• EXT_DECL UINT32 vos_htonl (UINT32 val)
Byte swapping 4 Bytes.

• EXT_DECL UINT32 vos_ntohl (UINT32 val)
Byte swapping 4 Bytes.

• EXT_DECL UINT64 vos_htonll (UINT64 val)
Byte swapping 8å Bytes.

• EXT_DECL UINT64 vos_ntohll (UINT64 val)
Byte swapping 8 Bytes.

• EXT_DECL UINT32 vos_dottedIP (const CHAR8 ∗pDottedIP)
Convert IP address from dotted dec.

• EXT_DECL const CHAR8 ∗ vos_ipDotted (UINT32 ipAddress)
Convert IP address to dotted dec.

• EXT_DECL BOOL8 vos_isMulticast (UINT32 ipAddress)
Check if the supplied address is a multicast group address.

• EXT_DECL VOS_ERR_T vos_getInterfaces (UINT32 ∗pAddrCnt, VOS_IF_REC_T ifAddrs[ ])
Get a list of interface addresses The caller has to provide an array of interface records to be filled.

• EXT_DECL BOOL8 vos_netIfUp (VOS_IP4_ADDR_T ifAddress)
Get the state of an interface.

• EXT_DECL INT32 vos_select (SOCKET highDesc, VOS_FDS_T ∗pReadableFD, VOS_FDS_T ∗p←WriteableFD, VOS_FDS_T ∗pErrorFD, VOS_TIMEVAL_T ∗pTimeOut)
Generated by Doxygen

324

File Documentation

select function.

• EXT_DECL VOS_ERR_T vos_sockInit (void)
Initialize the socket library.

• EXT_DECL void vos_sockTerm (void)
De-Initialize the socket library.

• EXT_DECL VOS_ERR_T vos_sockGetMAC (UINT8 pMAC[VOS_MAC_SIZE])
Return the MAC address of the default adapter.

• EXT_DECL VOS_ERR_T vos_sockOpenUDP (SOCKET ∗pSock, const VOS_SOCK_OPT_T ∗pOptions)
Create an UDP socket.

• EXT_DECL VOS_ERR_T vos_sockOpenTCP (SOCKET ∗pSock, const VOS_SOCK_OPT_T ∗pOptions)
Create a TCP socket.

• EXT_DECL VOS_ERR_T vos_sockClose (SOCKET sock)
Close a socket.

• EXT_DECL VOS_ERR_T vos_sockSetOptions (SOCKET sock, const VOS_SOCK_OPT_T ∗pOptions)
Set socket options.

• EXT_DECL VOS_ERR_T vos_sockJoinMC (SOCKET sock, UINT32 mcAddress, UINT32 ipAddress)
Join a multicast group.

• EXT_DECL VOS_ERR_T vos_sockLeaveMC (SOCKET sock, UINT32 mcAddress, UINT32 ipAddress)
Leave a multicast group.

• EXT_DECL VOS_ERR_T vos_sockSendUDP (SOCKET sock, const UINT8 ∗pBuffer, UINT32 ∗pSize, UIN←T32 ipAddress, UINT16 port)
Send UDP data.

• EXT_DECL VOS_ERR_T vos_sockReceiveUDP (SOCKET sock, UINT8 ∗pBuffer, UINT32 ∗pSize, UINT32
∗pSrcIPAddr, UINT16 ∗pSrcIPPort, UINT32 ∗pDstIPAddr, BOOL8 peek)
Receive UDP data.

• EXT_DECL VOS_ERR_T vos_sockBind (SOCKET sock, UINT32 ipAddress, UINT16 port)
Bind a socket to an address and port.

• EXT_DECL VOS_ERR_T vos_sockListen (SOCKET sock, UINT32 backlog)
Listen for incoming TCP connections.

• EXT_DECL VOS_ERR_T vos_sockAccept (SOCKET sock, SOCKET ∗pSock, UINT32 ∗pIPAddress, UINT16
∗pPort)
Accept an incoming TCP connection.

• EXT_DECL VOS_ERR_T vos_sockConnect (SOCKET sock, UINT32 ipAddress, UINT16 port)
Open a TCP connection.

• EXT_DECL VOS_ERR_T vos_sockSendTCP (SOCKET sock, const UINT8 ∗pBuffer, UINT32 ∗pSize)
Send TCP data.

• EXT_DECL VOS_ERR_T vos_sockReceiveTCP (SOCKET sock, UINT8 ∗pBuffer, UINT32 ∗pSize)
Receive TCP data.

• EXT_DECL VOS_ERR_T vos_sockSetMulticastIf (SOCKET sock, UINT32 mcIfAddress)
Set Using Multicast I/F.

• EXT_DECL VOS_IP4_ADDR_T vos_determineBindAddr (VOS_IP4_ADDR_T srcIP, VOS_IP4_ADDR_←T mcGroup, VOS_IP4_ADDR_T rcvMostly)
Determines the address to bind to since the behaviour in the different OS is different.

5.35.1

Detailed Description

Typedefs for OS abstraction.
This is the declaration for the OS independend socket interface

Generated by Doxygen

5.35 vos_sock.h File Reference

325

Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.
Id
vos_sock.h 1765 2018-10-04 12:18:54Z ahweiss
BL 2018-06-20: Ticket #184: Building with VS 2015: WIN64 and Windows threads (SOCKET instead of INT32)
BL 2018-03-06: 64Bit endian swap added
BL 2017-05-22: Ticket #122: Addendum for 64Bit compatibility (VOS_TIME_T -> VOS_TIMEVAL_T)

5.35.2

Macro Definition Documentation

5.35.2.1

VOS_MAX_SOCKET_CNT

#define VOS_MAX_SOCKET_CNT 4

The maximum number of sockets influences memory usage; for small systems we should define a smaller set.
The maximum number of concurrent usable sockets per application session

5.35.2.2

VOS_TTL_MULTICAST

#define VOS_TTL_MULTICAST 64

The maximum number of hops a multicast packet can take.
The maximum size for the interface name

5.35.3

Function Documentation

5.35.3.1

vos_determineBindAddr()

EXT_DECL VOS_IP4_ADDR_T vos_determineBindAddr (
VOS_IP4_ADDR_T srcIP,
VOS_IP4_ADDR_T mcGroup,
VOS_IP4_ADDR_T rcvMostly )

Determines the address to bind to since the behaviour in the different OS is different.

Generated by Doxygen

326

File Documentation

Parameters
in srcIP

in
in

IP to bind to (0 = any address)

mcGroup

MC group to join (0 = do not join)

rcvMostly

primarily used for receiving (tbd: bind on sender, too?)

Return values
Address to bind to

5.35.3.2

vos_dottedIP()

EXT_DECL UINT32 vos_dottedIP (
const CHAR8 ∗ pDottedIP )

Convert IP address from dotted dec.
to !host! endianess
Parameters
in p←DottedIP

IP address as dotted decimal.

Return values
address in UINT32 in host endianess

5.35.3.3

vos_getInterfaces()

EXT_DECL VOS_ERR_T vos_getInterfaces (
UINT32 ∗ pAddrCnt,
VOS_IF_REC_T ifAddrs[ ] )

Get a list of interface addresses The caller has to provide an array of interface records to be filled.
Parameters

in,out
in,out

pAddrCnt

in: pointer to array size of interface record out: pointer to number of interface records read

ifAddrs

array of interface records

Return values
VOS_NO_ERR
VOS_PARAM_ERR
VOS_MEM_ERR

no error
pAddrCnt and/or ifAddrs == NULL
memory allocation error

Generated by Doxygen

5.35 vos_sock.h File Reference
Return values
VOS_SOCK_ERR

5.35.3.4

GetAdaptersInfo() error

vos_htonl()

EXT_DECL UINT32 vos_htonl (
UINT32 val )

Byte swapping 4 Bytes.
Parameters
in val

Initial value.

Return values
swapped value

5.35.3.5

vos_htonll()

EXT_DECL UINT64 vos_htonll (
UINT64 val )

Byte swapping 8å Bytes.
Parameters
in val

Initial value.

Return values
swapped value

5.35.3.6

vos_htons()

EXT_DECL UINT16 vos_htons (
UINT16 val )

Byte swapping 2 Bytes.

Generated by Doxygen

327

328

File Documentation

Parameters
in val

Initial value.

Return values
swapped value

5.35.3.7

vos_ipDotted()

EXT_DECL const CHAR8∗ vos_ipDotted (
UINT32 ipAddress )

Convert IP address to dotted dec.
from !host! endianess
Parameters
in ipAddress

address in UINT32 in host endianess

Return values
IP address as dotted decimal.

5.35.3.8

vos_isMulticast()

EXT_DECL BOOL8 vos_isMulticast (
UINT32 ipAddress )

Check if the supplied address is a multicast group address.
Parameters
in ipAddress

IP address to check.

Return values
TRUE address is a multicast address
FALSE address is not a multicast address

Generated by Doxygen

5.35 vos_sock.h File Reference

5.35.3.9

vos_netIfUp()

EXT_DECL BOOL8 vos_netIfUp (
VOS_IP4_ADDR_T ifAddress )

Get the state of an interface.
Parameters
in ifAddress

address of interface to check

Return values
TRUE interface is up and ready FALSE interface is down / not ready

5.35.3.10

vos_ntohl()

EXT_DECL UINT32 vos_ntohl (
UINT32 val )

Byte swapping 4 Bytes.
Parameters
in val

Initial value.

Return values
swapped value

5.35.3.11

vos_ntohll()

EXT_DECL UINT64 vos_ntohll (
UINT64 val )

Byte swapping 8 Bytes.
Parameters
in val

Initial value.

Return values
swapped value

Generated by Doxygen

329

330

5.35.3.12

File Documentation

vos_ntohs()

EXT_DECL UINT16 vos_ntohs (
UINT16 val )

Byte swapping 2 Bytes.
Parameters
in val

Initial value.

Return values
swapped value

5.35.3.13

vos_select()

EXT_DECL INT32 vos_select (
SOCKET highDesc,
VOS_FDS_T ∗ pReadableFD,
VOS_FDS_T ∗ pWriteableFD,
VOS_FDS_T ∗ pErrorFD,
VOS_TIMEVAL_T ∗ pTimeOut )

select function.
Set the ready sockets in the supplied sets. Note: Some target systems might define this function as NOP.
Parameters

in
in,out
in,out
in,out
in

highDesc

max. socket descriptor + 1

pReadableFD

pointer to readable socket set

pWriteableFD

pointer to writeable socket set

pErrorFD

pointer to error socket set

pTimeOut

pointer to time out value

Return values
number of ready file descriptors

5.35.3.14

vos_sockAccept()

EXT_DECL VOS_ERR_T vos_sockAccept (
SOCKET sock,
Generated by Doxygen

5.35 vos_sock.h File Reference

331

SOCKET ∗ pSock,
UINT32 ∗ pIPAddress,
UINT16 ∗ pPort )

Accept an incoming TCP connection.
Accept incoming connections on the provided socket. May block and will return a new socket descriptor when
accepting a connection. The original socket ∗pSock, remains open.
Parameters
in
sock

out
out
out

Socket descriptor

pSock

Pointer to socket descriptor, on exit new socket

pIPAddress

source IP to receive on, 0 for any

pPort

port to receive on, 17224 for PD

Return values
VOS_NO_ERR
VOS_PARAM_ERR
VOS_UNKNOWN_ERR

5.35.3.15

no error
NULL parameter, parameter error
sock descriptor unknown error

vos_sockBind()

EXT_DECL VOS_ERR_T vos_sockBind (
SOCKET sock,
UINT32 ipAddress,
UINT16 port )

Bind a socket to an address and port.
Parameters
in sock

in
in

socket descriptor

ipAddress

source IP to receive from, 0 for any

port

port to receive from

Return values
VOS_NO_ERR
VOS_PARAM_ERR
VOS_IO_ERR
VOS_MEM_ERR

5.35.3.16

no error
parameter out of range/invalid
Input/Output error
resource error

vos_sockClose()

EXT_DECL VOS_ERR_T vos_sockClose (
Generated by Doxygen

332

File Documentation

SOCKET sock )

Close a socket.
Release any resources aquired by this socket
Parameters
in sock

socket descriptor

Return values
VOS_NO_ERR
VOS_PARAM_ERR

5.35.3.17

no error
pSock == NULL

vos_sockConnect()

EXT_DECL VOS_ERR_T vos_sockConnect (
SOCKET sock,
UINT32 ipAddress,
UINT16 port )

Open a TCP connection.
Parameters
in sock

in
in

socket descriptor

ipAddress

destination IP

port

destination port

Return values
VOS_NO_ERR
VOS_PARAM_ERR
VOS_IO_ERR

5.35.3.18

no error
parameter out of range/invalid
Input/Output error

vos_sockGetMAC()

EXT_DECL VOS_ERR_T vos_sockGetMAC (
UINT8 pMAC[VOS_MAC_SIZE] )

Return the MAC address of the default adapter.
Parameters
out pMAC

return MAC address.

Generated by Doxygen

5.35 vos_sock.h File Reference
Return values
VOS_NO_ERR

no error

VOS_PARAM_ERR

pMAC == NULL

VOS_SOCK_ERR

5.35.3.19

socket not available or option not supported

vos_sockInit()

EXT_DECL VOS_ERR_T vos_sockInit (
void )

Initialize the socket library.
Must be called once before any other call
Return values
VOS_NO_ERR

no error

VOS_SOCK_ERR

5.35.3.20

sockets not supported

vos_sockJoinMC()

EXT_DECL VOS_ERR_T vos_sockJoinMC (
SOCKET sock,
UINT32 mcAddress,
UINT32 ipAddress )

Join a multicast group.
Note: Some target systems might not support this option.
Parameters
in sock

in
in

socket descriptor

mcAddress

multicast group to join

ipAddress

depicts interface on which to join, default 0 for any

Return values
VOS_NO_ERR
VOS_PARAM_ERR
VOS_SOCK_ERR

Generated by Doxygen

no error
parameter out of range/invalid
option not supported

333

334

File Documentation

5.35.3.21

vos_sockLeaveMC()

EXT_DECL VOS_ERR_T vos_sockLeaveMC (
SOCKET sock,
UINT32 mcAddress,
UINT32 ipAddress )

Leave a multicast group.
Note: Some target systems might not support this option.
Parameters
in sock

in
in

socket descriptor

mcAddress

multicast group to join

ipAddress

depicts interface on which to leave, default 0 for any

Return values
VOS_NO_ERR
VOS_INIT_ERR

no error
module not initialised

VOS_NOINIT_ERR

invalid handle

VOS_PARAM_ERR

parameter out of range/invalid

VOS_SOCK_ERR

5.35.3.22

option not supported

vos_sockListen()

EXT_DECL VOS_ERR_T vos_sockListen (
SOCKET sock,
UINT32 backlog )

Listen for incoming TCP connections.
Parameters
in sock

in

backlog

socket descriptor
maximum connection attempts if system is busy

Return values
VOS_NO_ERR
VOS_PARAM_ERR
VOS_IO_ERR
VOS_MEM_ERR

no error
parameter out of range/invalid
Input/Output error
resource error

Generated by Doxygen

5.35 vos_sock.h File Reference

5.35.3.23

335

vos_sockOpenTCP()

EXT_DECL VOS_ERR_T vos_sockOpenTCP (
SOCKET ∗ pSock,
const VOS_SOCK_OPT_T ∗ pOptions )

Create a TCP socket.
Return a socket descriptor for further calls. The socket options are optional and can be applied later.
Parameters
out pSock

in

pOptions

pointer to socket descriptor returned
pointer to socket options (optional)

Return values
VOS_NO_ERR
VOS_PARAM_ERR
VOS_SOCK_ERR

5.35.3.24

no error
pSock == NULL
socket not available or option not supported

vos_sockOpenUDP()

EXT_DECL VOS_ERR_T vos_sockOpenUDP (
SOCKET ∗ pSock,
const VOS_SOCK_OPT_T ∗ pOptions )

Create an UDP socket.
Return a socket descriptor for further calls. The socket options are optional and can be applied later. Note: Some
target systems might not support every option.
Parameters
out pSock

in

pOptions

pointer to socket descriptor returned
pointer to socket options (optional)

Return values
VOS_NO_ERR
VOS_PARAM_ERR
VOS_SOCK_ERR

5.35.3.25

no error
pSock == NULL
socket not available or option not supported

vos_sockReceiveTCP()

EXT_DECL VOS_ERR_T vos_sockReceiveTCP (
SOCKET sock,
Generated by Doxygen

336

File Documentation

UINT8 ∗ pBuffer,
UINT32 ∗ pSize )

Receive TCP data.
The caller must provide a sufficient sized buffer. If the supplied buffer is smaller than the bytes received, ∗pSize will
reflect the number of copied bytes and the call should be repeated until ∗pSize is 0 (zero). If the socket was created
in blocking-mode (default), then this call will block and will only return if data has been received or the socket was
closed or an error occured. If called in non-blocking mode, and no data is available, VOS_NODATA_ERR will be
returned.
Parameters

in
out
in,out

sock

socket descriptor

pBuffer

pointer to applications data buffer

pSize

pointer to the received data size

Return values
VOS_NO_ERR
VOS_PARAM_ERR
VOS_IO_ERR
VOS_NODATA_ERR
VOS_BLOCK_ERR

5.35.3.26

no error
sock descriptor unknown, parameter error
data could not be read
no data in non-blocking
call would have blocked in blocking mode

vos_sockReceiveUDP()

EXT_DECL VOS_ERR_T vos_sockReceiveUDP (
SOCKET sock,
UINT8 ∗ pBuffer,
UINT32 ∗ pSize,
UINT32 ∗ pSrcIPAddr,
UINT16 ∗ pSrcIPPort,
UINT32 ∗ pDstIPAddr,
BOOL8 peek )

Receive UDP data.
The caller must provide a sufficient sized buffer. If the supplied buffer is smaller than the bytes received, ∗pSize will
reflect the number of copied bytes and the call should be repeated until ∗pSize is 0 (zero). If the socket was created
in blocking-mode (default), then this call will block and will only return if data has been received or the socket was
closed or an error occured. If called in non-blocking mode, and no data is available, VOS_NODATA_ERR will be
returned. If pointers are provided, source IP, source port and destination IP will be reported on return.
Parameters

in
out
in,out
out
out
out
in

sock

socket descriptor

pBuffer

pointer to applications data buffer

pSize

pointer to the received data size

pSrcIPAddr

pointer to source IP

pSrcIPPort

pointer to source port

pDstIPAddr

pointer to dest IP

peek

if true, leave data in queue

Generated by Doxygen

5.35 vos_sock.h File Reference
Return values
VOS_NO_ERR
VOS_PARAM_ERR
VOS_IO_ERR
VOS_NODATA_ERR
VOS_BLOCK_ERR

5.35.3.27

no error
sock descriptor unknown, parameter error
data could not be read
no data
Call would have blocked in blocking mode

vos_sockSendTCP()

EXT_DECL VOS_ERR_T vos_sockSendTCP (
SOCKET sock,
const UINT8 ∗ pBuffer,
UINT32 ∗ pSize )

Send TCP data.
Send data to the supplied address and port.
Parameters

in
in
in,out

sock

socket descriptor

pBuffer

pointer to data to send

pSize

In: size of the data to send, Out: no of bytes sent

Return values
VOS_NO_ERR
VOS_PARAM_ERR
VOS_IO_ERR
VOS_NOCONN_ERR
VOS_BLOCK_ERR

5.35.3.28

no error
sock descriptor unknown, parameter error
data could not be sent
no TCP connection
call would have blocked in blocking mode, data partially sent

vos_sockSendUDP()

EXT_DECL VOS_ERR_T vos_sockSendUDP (
SOCKET sock,
const UINT8 ∗ pBuffer,
UINT32 ∗ pSize,
UINT32 ipAddress,
UINT16 port )

Send UDP data.
Send data to the given address and port.

Generated by Doxygen

337

338

File Documentation

Parameters

in
in
in,out
in
in

sock

socket descriptor

pBuffer

pointer to data to send

pSize

In: size of the data to send, Out: no of bytes sent

ipAddress

destination IP

port

destination port

Return values
VOS_NO_ERR
VOS_PARAM_ERR
VOS_IO_ERR
VOS_BLOCK_ERR

5.35.3.29

no error
parameter out of range/invalid
data could not be sent
Call would have blocked in blocking mode

vos_sockSetMulticastIf()

EXT_DECL VOS_ERR_T vos_sockSetMulticastIf (
SOCKET sock,
UINT32 mcIfAddress )

Set Using Multicast I/F.
Parameters
in sock

in

socket descriptor

mcIfAddress

Return values
VOS_NO_ERR
VOS_PARAM_ERR

5.35.3.30

using Multicast I/F Address

no error
sock descriptor unknown, parameter error

vos_sockSetOptions()

EXT_DECL VOS_ERR_T vos_sockSetOptions (
SOCKET sock,
const VOS_SOCK_OPT_T ∗ pOptions )

Set socket options.
Note: Some target systems might not support each option.
Parameters
in sock

in

pOptions

socket descriptor
pointer to socket options (optional)
Generated by Doxygen

5.36 vos_thread.h File Reference
Return values
VOS_NO_ERR
VOS_PARAM_ERR

5.35.3.31

339

no error
parameter out of range/invalid

vos_sockTerm()

EXT_DECL void vos_sockTerm (
void )

De-Initialize the socket library.
Must be called after last socket call

5.36

vos_thread.h File Reference

Threading functions for OS abstraction.

#include "vos_types.h"
Include dependency graph for vos_thread.h:

vos_thread.h

vos_types.h

stdint.h

This graph shows which files directly or indirectly include this file:
vos_thread.h

vos_mem.h

vos_shared_mem.h

trdp_private.h

trdp_pdcom.h

trdp_pdcom.c

trdp_stats.h

trdp_if.c

trdp_stats.c

trdp_if.h

trdp_if_light.h

trdp_xml.h

trdp_xml.c

trdp_utils.h

trdp_utils.c

trdp_types.h

tau_xml.h

tau_dnr_types.h

trdp_mdcom.h

trdp_mdcom.c

tau_dnr.h

tau_xml.c

tau_dnr.c

tau_cstinfo.c

tau_tti.c

tau_ctrl.c

Generated by Doxygen

vos_mem.c

vos_utils.c

tau_tti_types.h

tau_tti.h

tau_marshall.h

tau_ctrl_types.h

tau_ctrl.h

tau_marshall.c

340

File Documentation

Macros
• #define VOS_MAX_THREAD_CNT 100
The maximum number of concurrent usable threads.

• #define VOS_SEMA_WAIT_FOREVER 0xFFFFFFFFU
Timeout value to wait forever for a semaphore.

Typedefs
• typedef UINT8 VOS_THREAD_PRIORITY_T
Thread priority range from 1 (highest) to 255 (lowest), 0 default of the target system.

• typedef void(__cdecl ∗ VOS_THREAD_FUNC_T) (void ∗pArg)
Thread function definition.

• typedef struct VOS_MUTEX ∗ VOS_MUTEX_T
Hidden mutex handle definition.

• typedef struct VOS_SEMA ∗ VOS_SEMA_T
Hidden semaphore handle definition.

• typedef void ∗ VOS_THREAD_T
Hidden thread handle definition.

Enumerations
• enum VOS_THREAD_POLICY_T
Thread policy matching pthread/Posix defines.

• enum VOS_SEMA_STATE_T
State of the semaphore.

Functions
• EXT_DECL VOS_ERR_T vos_threadInit (void)
Initialize the thread library.

• EXT_DECL void vos_threadTerm (void)
De-Initialize the thread library.

• EXT_DECL VOS_ERR_T vos_threadCreate (VOS_THREAD_T ∗pThread, const CHAR8 ∗pName, VOS_←THREAD_POLICY_T policy, VOS_THREAD_PRIORITY_T priority, UINT32 interval, UINT32 stackSize, V←OS_THREAD_FUNC_T pFunction, void ∗pArguments)
Create a thread.

• EXT_DECL void vos_cyclicThread (UINT32 interval, VOS_THREAD_FUNC_T pFunction, void ∗pArguments)
Cyclic thread functions.

• EXT_DECL VOS_ERR_T vos_threadTerminate (VOS_THREAD_T thread)
Terminate a thread.

• EXT_DECL VOS_ERR_T vos_threadIsActive (VOS_THREAD_T thread)
Is the thread still active? This call will return VOS_NO_ERR if the thread is still active, VOS_PARAM_ERR in case it
ran out.

• EXT_DECL VOS_ERR_T vos_threadDelay (UINT32 delay)
Delay the execution of the current thread by the given delay in us.

• EXT_DECL VOS_ERR_T vos_threadSelf (VOS_THREAD_T ∗pThread)
Return thread handle of calling task.

• EXT_DECL void vos_getTime (VOS_TIMEVAL_T ∗pTime)
Generated by Doxygen

5.36 vos_thread.h File Reference

341

Return the current time in sec and us.

• EXT_DECL const CHAR8 ∗ vos_getTimeStamp (void)
Get a time-stamp string.

• EXT_DECL void vos_clearTime (VOS_TIMEVAL_T ∗pTime)
Clear the time stamp.

• EXT_DECL void vos_addTime (VOS_TIMEVAL_T ∗pTime, const VOS_TIMEVAL_T ∗pAdd)
Add the second to the first time stamp, return sum in first.

• EXT_DECL void vos_subTime (VOS_TIMEVAL_T ∗pTime, const VOS_TIMEVAL_T ∗pSub)
Subtract the second from the first time stamp, return diff in first.

• EXT_DECL INT32 vos_cmpTime (const VOS_TIMEVAL_T ∗pTime, const VOS_TIMEVAL_T ∗pCmp)
Compare the second from the first time stamp, return diff in first.

• EXT_DECL void vos_divTime (VOS_TIMEVAL_T ∗pTime, UINT32 divisor)
Divide the first time by the second, return quotient in first.

• EXT_DECL void vos_mulTime (VOS_TIMEVAL_T ∗pTime, UINT32 mul)
Multiply the first time by the second, return product in first.

• EXT_DECL void vos_getUuid (VOS_UUID_T pUuID)
Get a universal unique identifier according to RFC 4122 time based version.

• EXT_DECL VOS_ERR_T vos_mutexCreate (VOS_MUTEX_T ∗pMutex)
Create a mutex.

• EXT_DECL void vos_mutexDelete (VOS_MUTEX_T pMutex)
Delete a mutex.

• EXT_DECL VOS_ERR_T vos_mutexLock (VOS_MUTEX_T pMutex)
Take a mutex.

• EXT_DECL VOS_ERR_T vos_mutexTryLock (VOS_MUTEX_T pMutex)
Try to take a mutex.

• EXT_DECL VOS_ERR_T vos_mutexUnlock (VOS_MUTEX_T pMutex)
Release a mutex.

• EXT_DECL VOS_ERR_T vos_semaCreate (VOS_SEMA_T ∗pSema, VOS_SEMA_STATE_T initialState)
Create a semaphore.

• EXT_DECL void vos_semaDelete (VOS_SEMA_T sema)
Delete a semaphore.

• EXT_DECL VOS_ERR_T vos_semaTake (VOS_SEMA_T sema, UINT32 timeout)
Take a semaphore.

• EXT_DECL void vos_semaGive (VOS_SEMA_T sema)
Give a semaphore.

5.36.1

Detailed Description

Threading functions for OS abstraction.
Thread-, semaphore- and time-handling functions

Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH

Generated by Doxygen

342

File Documentation

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2014. All rights reserved.

Id
vos_thread.h 1763 2018-09-21 16:03:13Z ahweiss

BL 2017-05-22: Ticket #122: Addendum for 64Bit compatibility (VOS_TIME_T -> VOS_TIMEVAL_T)

5.36.2

Function Documentation

5.36.2.1

vos_addTime()

EXT_DECL void vos_addTime (
VOS_TIMEVAL_T ∗ pTime,
const VOS_TIMEVAL_T ∗ pAdd )

Add the second to the first time stamp, return sum in first.
Parameters

in,out
in

5.36.2.2

pTime

Pointer to time value

pAdd

Pointer to time value

vos_clearTime()

EXT_DECL void vos_clearTime (
VOS_TIMEVAL_T ∗ pTime )

Clear the time stamp.
Parameters
out pTime

5.36.2.3

Pointer to time value

vos_cmpTime()

EXT_DECL INT32 vos_cmpTime (
const VOS_TIMEVAL_T ∗ pTime,
const VOS_TIMEVAL_T ∗ pCmp )
Generated by Doxygen

5.36 vos_thread.h File Reference

Compare the second from the first time stamp, return diff in first.

Generated by Doxygen

343

344

File Documentation

Parameters

in,out
in

pTime

Pointer to time value

pCmp

Pointer to time value to compare

Return values
0 pTime == pCmp
-1

pTime < pCmp

1

pTime > pCmp

5.36.2.4

vos_cyclicThread()

EXT_DECL void vos_cyclicThread (
UINT32 interval,
VOS_THREAD_FUNC_T pFunction,
void ∗ pArguments )

Cyclic thread functions.
Wrapper for cyclic threads. The thread function will be called cyclically with interval.
Parameters
in interval

in
in

Interval for cyclic threads in us (incl. runtime)

pFunction

Pointer to the thread function

pArguments

Pointer to the thread function parameters

Return values
void

5.36.2.5

vos_divTime()

EXT_DECL void vos_divTime (
VOS_TIMEVAL_T ∗ pTime,
UINT32 divisor )

Divide the first time by the second, return quotient in first.
Parameters

in,out
in

pTime

Pointer to time value

divisor

Divisor

Generated by Doxygen

5.36 vos_thread.h File Reference

5.36.2.6

345

vos_getTime()

EXT_DECL void vos_getTime (
VOS_TIMEVAL_T ∗ pTime )

Return the current time in sec and us.
Parameters
out pTime

5.36.2.7

Pointer to time value

vos_getTimeStamp()

EXT_DECL const CHAR8∗ vos_getTimeStamp (
void )

Get a time-stamp string.
Get a time-stamp string for debugging in the form "yyyymmdd-hh:mm:ss.ms" Depending on the used OS / hardware
the time might not be a real-time stamp but relative from start of system.
Return values
timestamp

5.36.2.8

"yyyymmdd-hh:mm:ss.ms"

vos_getUuid()

EXT_DECL void vos_getUuid (
VOS_UUID_T pUuID )

Get a universal unique identifier according to RFC 4122 time based version.
Parameters
out pUuID

5.36.2.9

Pointer to a universal unique identifier

vos_mulTime()

EXT_DECL void vos_mulTime (
VOS_TIMEVAL_T ∗ pTime,
UINT32 mul )
Generated by Doxygen

346

File Documentation

Multiply the first time by the second, return product in first.
Parameters

in,out
in

5.36.2.10

pTime

Pointer to time value

mul

Factor

vos_mutexCreate()

EXT_DECL VOS_ERR_T vos_mutexCreate (
VOS_MUTEX_T ∗ pMutex )

Create a mutex.
Return a mutex handle. The mutex will be available at creation.
Parameters
out pMutex

Pointer to mutex handle

Return values
VOS_NO_ERR
VOS_INIT_ERR

no error
module not initialised

VOS_PARAM_ERR

pMutex == NULL

VOS_MUTEX_ERR

no mutex available

5.36.2.11

vos_mutexDelete()

EXT_DECL void vos_mutexDelete (
VOS_MUTEX_T pMutex )

Delete a mutex.
Release the resources taken by the mutex.
Parameters
in pMutex

Return values
VOS_NO_ERR

mutex handle

no error

Generated by Doxygen

5.36 vos_thread.h File Reference

5.36.2.12

vos_mutexLock()

EXT_DECL VOS_ERR_T vos_mutexLock (
VOS_MUTEX_T pMutex )

Take a mutex.
Wait for the mutex to become available (lock).
Parameters
in pMutex

mutex handle

Return values
VOS_NO_ERR
VOS_INIT_ERR
VOS_NOINIT_ERR

5.36.2.13

no error
module not initialised
invalid handle

vos_mutexTryLock()

EXT_DECL VOS_ERR_T vos_mutexTryLock (
VOS_MUTEX_T pMutex )

Try to take a mutex.
If mutex is can't be taken VOS_MUTEX_ERR is returned.
Parameters
in pMutex

mutex handle

Return values
VOS_NO_ERR
VOS_INIT_ERR

no error
module not initialised

VOS_NOINIT_ERR

invalid handle

VOS_MUTEX_ERR

no mutex available

5.36.2.14

vos_mutexUnlock()

EXT_DECL VOS_ERR_T vos_mutexUnlock (
VOS_MUTEX_T pMutex )

Release a mutex.
Unlock the mutex.

Generated by Doxygen

347

348

File Documentation

Parameters
in pMutex

5.36.2.15

mutex handle

vos_semaCreate()

EXT_DECL VOS_ERR_T vos_semaCreate (
VOS_SEMA_T ∗ pSema,
VOS_SEMA_STATE_T initialState )

Create a semaphore.
Return a semaphore handle. Depending on the initial state the semaphore will be available on creation or not.
Parameters
out pSema
initialState

in

Pointer to semaphore handle
The initial state of the sempahore

Return values
VOS_NO_ERR
VOS_INIT_ERR
VOS_PARAM_ERR
VOS_SEMA_ERR

5.36.2.16

no error
module not initialised
parameter out of range/invalid
no semaphore available

vos_semaDelete()

EXT_DECL void vos_semaDelete (
VOS_SEMA_T sema )

Delete a semaphore.
This will eventually release any processes waiting for the semaphore.
Parameters
in sema

5.36.2.17

semaphore handle

vos_semaGive()

EXT_DECL void vos_semaGive (
VOS_SEMA_T sema )
Generated by Doxygen

5.36 vos_thread.h File Reference

Give a semaphore.
Release (increase) a semaphore.
Parameters
in sema

5.36.2.18

semaphore handle

vos_semaTake()

EXT_DECL VOS_ERR_T vos_semaTake (
VOS_SEMA_T sema,
UINT32 timeout )

Take a semaphore.
Try to get (decrease) a semaphore.
Parameters
in sema

semaphore handle

timeout

in

Max. time in us to wait, 0 means no wait

Return values
VOS_NO_ERR
VOS_INIT_ERR

no error
module not initialised

VOS_NOINIT_ERR

invalid handle

VOS_PARAM_ERR

parameter out of range/invalid

VOS_SEMA_ERR

5.36.2.19

could not get semaphore in time

vos_subTime()

EXT_DECL void vos_subTime (
VOS_TIMEVAL_T ∗ pTime,
const VOS_TIMEVAL_T ∗ pSub )

Subtract the second from the first time stamp, return diff in first.
Parameters

in,out
in

pTime

Pointer to time value

pSub

Pointer to time value

Generated by Doxygen

349

350

File Documentation

5.36.2.20

vos_threadCreate()

EXT_DECL VOS_ERR_T vos_threadCreate (
VOS_THREAD_T ∗ pThread,
const CHAR8 ∗ pName,
VOS_THREAD_POLICY_T policy,
VOS_THREAD_PRIORITY_T priority,
UINT32 interval,
UINT32 stackSize,
VOS_THREAD_FUNC_T pFunction,
void ∗ pArguments )

Create a thread.
Create a thread and return a thread handle for further requests. Not each parameter may be supported by all target
systems!
Parameters
out pThread

in
in
in
in
in
in
in

Pointer to returned thread handle

pName

Pointer to name of the thread (optional)

policy

Scheduling policy (FIFO, Round Robin or other)

priority

Scheduling priority (1...255 (highest), default 0)

interval

Interval for cyclic threads in us (optional)

stackSize

Minimum stacksize, default 0: 16kB

pFunction

Pointer to the thread function

pArguments

Pointer to the thread function parameters

Return values
VOS_NO_ERR
VOS_INIT_ERR

no error
module not initialised

VOS_NOINIT_ERR

invalid handle

VOS_PARAM_ERR

parameter out of range/invalid

5.36.2.21

vos_threadDelay()

EXT_DECL VOS_ERR_T vos_threadDelay (
UINT32 delay )

Delay the execution of the current thread by the given delay in us.
Parameters
in delay

Delay in us

Return values
VOS_NO_ERR
VOS_INIT_ERR

no error
module not initialised
Generated by Doxygen

5.36 vos_thread.h File Reference

5.36.2.22

351

vos_threadInit()

EXT_DECL VOS_ERR_T vos_threadInit (
void )

Initialize the thread library.
Must be called once before any other call
Return values
VOS_NO_ERR
VOS_INIT_ERR

5.36.2.23

no error
threading not supported

vos_threadIsActive()

EXT_DECL VOS_ERR_T vos_threadIsActive (
VOS_THREAD_T thread )

Is the thread still active? This call will return VOS_NO_ERR if the thread is still active, VOS_PARAM_ERR in case
it ran out.
Parameters
in thread

Thread handle

Return values
VOS_NO_ERR
VOS_INIT_ERR

no error
module not initialised

VOS_NOINIT_ERR

invalid handle

VOS_PARAM_ERR

parameter out of range/invalid

5.36.2.24

vos_threadSelf()

EXT_DECL VOS_ERR_T vos_threadSelf (
VOS_THREAD_T ∗ pThread )

Return thread handle of calling task.
Parameters
out pThread

Generated by Doxygen

pointer to thread handle

352

File Documentation

Return values
VOS_NO_ERR

no error

VOS_PARAM_ERR

5.36.2.25

parameter out of range/invalid

vos_threadTerm()

EXT_DECL void vos_threadTerm (
void

)

De-Initialize the thread library.
Must be called after last thread/timer call

5.36.2.26

vos_threadTerminate()

EXT_DECL VOS_ERR_T vos_threadTerminate (
VOS_THREAD_T thread )

Terminate a thread.
This call will terminate the thread with the given threadId and release all resources. Depending on the underlying
architectures, it may just block until the thread ran out.
Parameters
in thread

Thread handle (or NULL if current thread)

Return values
VOS_NO_ERR
VOS_INIT_ERR

no error
module not initialised

VOS_NOINIT_ERR

invalid handle

VOS_PARAM_ERR

parameter out of range/invalid

5.37

vos_types.h File Reference

Typedefs for OS abstraction.
Generated by Doxygen

5.37 vos_types.h File Reference

353

#include 
Include dependency graph for vos_types.h:

vos_types.h

stdint.h

This graph shows which files directly or indirectly include this file:
vos_types.h

vos_thread.h

vos_sock.h

vos_shared_mem.h

trdp_types.h

tau_tti_types.h

tau_tti.h

tau_ctrl_types.h

vos_mem.h

tau_dnr_types.h

tau_marshall.h

tau_cstinfo.c

tau_ctrl.h

trdp_if_light.h

tau_dnr.h

tau_marshall.c

vos_mem.c

trdp_private.h

trdp_mdcom.h

tau_dnr.c

vos_utils.h

vos_utils.c

trdp_mdcom.c

trdp_utils.h

trdp_if.h

trdp_utils.c

trdp_stats.h

trdp_pdcom.c

tau_xml.h

trdp_pdcom.h

trdp_stats.c

trdp_xml.h

trdp_if.c

tau_xml.c

trdp_xml.c

tau_tti.c

tau_ctrl.c

Data Structures
• struct VOS_VERSION_T
Version information.

Macros
• #define INLINE inline
inline macros

• #define AV_ERROR 0x00
ANTIVALENT8 values.

• #define TR_DIR1 0x01
Directions/Orientations.

Typedefs
• typedef UINT8 VOS_UUID_T[16]
universal unique identifier according to RFC 4122, time based version

• typedef struct timeval VOS_TIMEVAL_T
Timer value compatible with timeval / select.

• typedef void(∗ VOS_PRINT_DBG_T) (void ∗pRefCon, VOS_LOG_T category, const CHAR8 ∗pTime, const
CHAR8 ∗pFile, UINT16 LineNumber, const CHAR8 ∗pMsgStr)
Function definition for error/debug output.
Generated by Doxygen

354

File Documentation

Enumerations
• enum VOS_ERR_T {
VOS_NO_ERR = 0,
VOS_PARAM_ERR = -1,
VOS_INIT_ERR = -2,
VOS_NOINIT_ERR = -3,
VOS_TIMEOUT_ERR = -4,
VOS_NODATA_ERR = -5,
VOS_SOCK_ERR = -6,
VOS_IO_ERR = -7,
VOS_MEM_ERR = -8,
VOS_SEMA_ERR = -9,
VOS_QUEUE_ERR = -10,
VOS_QUEUE_FULL_ERR = -11,
VOS_MUTEX_ERR = -12,
VOS_THREAD_ERR = -13,
VOS_BLOCK_ERR = -14,
VOS_INTEGRATION_ERR = -15,
VOS_NOCONN_ERR = -16,
VOS_INUSE_ERR = -49,
VOS_UNKNOWN_ERR = -99 }
Return codes for all VOS API functions.

• enum VOS_LOG_T {
VOS_LOG_ERROR = 0,
VOS_LOG_WARNING = 1,
VOS_LOG_INFO = 2,
VOS_LOG_DBG = 3,
VOS_LOG_USR = 4 }
Categories for logging.

5.37.1

Detailed Description

Typedefs for OS abstraction.
Note
Project: TCNOpen TRDP prototype stack
Author
Bernd Loehr, NewTec GmbH
Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.
Id
vos_types.h 1763 2018-09-21 16:03:13Z ahweiss
BL
BL
BL
BL
BL
BL
BL

2018-06-25:
2018-05-03:
2017-11-17:
2017-11-10:
2017-05-22:
2017-05-08:
2016-07-06:

Ticket #202: vos_mutexTrylock return value
no inline if < C99
Undone: Ticket #169 Encapsulate declaration of packed structures within a macro
Additional log type: VOS_LOG_USR
Ticket #122: Addendum for 64Bit compatibility (VOS_TIME_T -> VOS_TIMEVAL_T)
Doxygen comment errors
Ticket #122 64Bit compatibility (+ compiler warnings)
Generated by Doxygen

5.37 vos_types.h File Reference

5.37.2

Typedef Documentation

5.37.2.1

VOS_PRINT_DBG_T

355

typedef void(∗ VOS_PRINT_DBG_T) (void ∗pRefCon, VOS_LOG_T category, const CHAR8 ∗pTime, const
CHAR8 ∗pFile, UINT16 LineNumber, const CHAR8 ∗pMsgStr)

Function definition for error/debug output.
The function will be called for logging and error message output. The user can decide, what kind of info will be
logged by filtering the category.
Parameters
in pRefCon

in
in
in
in
in

5.37.2.2

pointer to user context

category

Log category (Error, Warning, Info etc.)

pTime

pointer to NULL-terminated string of time stamp

pFile

pointer to NULL-terminated string of source module

LineNumber
pMsgStr

Line number
pointer to NULL-terminated string

VOS_TIMEVAL_T

typedef struct timeval VOS_TIMEVAL_T

Timer value compatible with timeval / select.
Relative or absolute date, depending on usage Assume 32 Bit system, if not defined

5.37.3

Enumeration Type Documentation

5.37.3.1

VOS_ERR_T

enum VOS_ERR_T

Return codes for all VOS API functions.
Enumerator
VOS_NO_ERR
VOS_PARAM_ERR
VOS_INIT_ERR
Generated by Doxygen

No error.
Necessary parameter missing or out of range.
Call without valid initialization.

356

File Documentation

Enumerator
VOS_NOINIT_ERR
VOS_TIMEOUT_ERR
VOS_NODATA_ERR
VOS_SOCK_ERR
VOS_IO_ERR
VOS_MEM_ERR
VOS_SEMA_ERR
VOS_QUEUE_ERR
VOS_QUEUE_FULL_ERR
VOS_MUTEX_ERR
VOS_THREAD_ERR

The supplied handle/reference is not valid.
Timout.
Non blocking mode: no data received.
Socket option not supported.
Socket IO error, data can't be received/sent.
No more memory available.
Semaphore not available.
Queue empty.
Queue full.
Mutex not available.
Thread creation error.

VOS_BLOCK_ERR

System call would have blocked in blocking mode.

VOS_INTEGRATION_ERR

Alignment or endianess for selected target wrong.

VOS_NOCONN_ERR
VOS_INUSE_ERR
VOS_UNKNOWN_ERR

5.37.3.2

No TCP connection.
Resource is still in use.
Unknown error.

VOS_LOG_T

enum VOS_LOG_T

Categories for logging.
Enumerator
VOS_LOG_ERROR
VOS_LOG_WARNING

5.38

This is a critical error.
This is a warning.

VOS_LOG_INFO

This is an info.

VOS_LOG_DBG

This is a debug info.

VOS_LOG_USR

This is a user info.

vos_utils.c File Reference

Common functions for VOS.

#include
#include
#include
#include
#include
#include


"vos_utils.h"
"vos_sock.h"
"vos_thread.h"
"vos_mem.h"
"vos_private.h"
Generated by Doxygen

5.38 vos_utils.c File Reference

357

Include dependency graph for vos_utils.c:

vos_utils.c

string.h

stdio.h

vos_utils.h

vos_sock.h

stddef.h

vos_mem.h

vos_private.h

vos_thread.h

vos_types.h

stdint.h

Functions
• VOS_ERR_T vos_init (void ∗pRefCon, VOS_PRINT_DBG_T pDebugOutput)
Initialize the virtual operating system.

• EXT_DECL void vos_terminate (void)
DeInitialize the vos library.

• UINT32 vos_crc32 (UINT32 crc, const UINT8 ∗pData, UINT32 dataLen)
Compute crc32 according to IEEE802.3.

• UINT32 vos_sc32 (UINT32 crc, const UINT8 ∗pData, UINT32 dataLen)
Compute crc32 according to IEC 61375-2-3 B.7.

• const char ∗ vos_getVersionString (void)
Return a human readable version representation.

• EXT_DECL const VOS_VERSION_T ∗ vos_getVersion (void)
Return version.

• EXT_DECL const CHAR8 ∗ vos_getErrorString (VOS_ERR_T error)
Return a human readable error representation.

5.38.1

Detailed Description

Common functions for VOS.
Common functions of the abstraction layer. Mainly debugging support.

Note
Project: TCNOpen TRDP prototype stack

Generated by Doxygen

358

File Documentation

Author
Bernd Loehr, NewTec GmbH

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.

Id
vos_utils.c 1761 2018-09-18 15:54:02Z bloehr

BL
BL
BL
BL
BL
BL
BL

2017-05-08:
2017-02-27:
2016-08-17:
2016-07-06:
2016-03-10:
2016-02-10:
2014-02-28:

Compiler warnings
#142 Compiler warnings / MISRA-C 2012 issues
parentheses added (compiler warning)
Ticket #122 64Bit compatibility (+ compiler warnings)
Ticket #114 SC-32
ifdef DEBUG for some functions
Ticket #25: CRC32 calculation is not according IEEE802.3

5.38.2

Function Documentation

5.38.2.1

vos_crc32()

UINT32 vos_crc32 (
UINT32 crc,
const UINT8 ∗ pData,
UINT32 dataLen )

Compute crc32 according to IEEE802.3.
Calculate CRC for the given buffer and length.
/ to IEC 61375-2-3 A.3 Note: Returned CRC is inverted
Parameters

in
in,out
in

crc
pData

Initial value.
Pointer to data.

dataLen

length in bytes of data.

Return values
crc32 according to
IEEE802.3

Generated by Doxygen

5.38 vos_utils.c File Reference

5.38.2.2

vos_getErrorString()

EXT_DECL const CHAR8∗ vos_getErrorString (
VOS_ERR_T error )

Return a human readable error representation.
Parameters
in error

The TRDP or VOS error code

Return values
const string pointer to error string

5.38.2.3

vos_getVersion()

EXT_DECL const VOS_VERSION_T∗ vos_getVersion (
void )

Return version.
Return pointer to version structure
Return values
VOS_VERSION←_T

5.38.2.4

vos_getVersionString()

const char∗ vos_getVersionString (
void )

Return a human readable version representation.
Return string in the form 'v.r.u.b'
Return values
const string

Generated by Doxygen

359

360

5.38.2.5

File Documentation

vos_init()

VOS_ERR_T vos_init (
void ∗ pRefCon,
VOS_PRINT_DBG_T pDebugOutput )

Initialize the virtual operating system.
Initialize the vos library.
Parameters
in pRefCon

in

pDebugOutput

Return values
VOS_NO_ERR

5.38.2.6

context for debug output function
Pointer to debug output function.

no error VOS_INTEGRATION_ERR if endianess/alignment mismatch VOS_SOCK_ERR
sockets not supported VOS_UNKNOWN_ERR initialisation error

vos_sc32()

UINT32 vos_sc32 (
UINT32 crc,
const UINT8 ∗ pData,
UINT32 dataLen )

Compute crc32 according to IEC 61375-2-3 B.7.
Compute crc32 according to IEC 61375-2-3 B.7 Note: Returned CRC is inverted.
Parameters

in
in,out
in

crc
pData

Initial value.
Pointer to data.

dataLen

length in bytes of data.

Return values
sc32 according to IEC 61375-2-3

5.38.2.7

vos_terminate()

EXT_DECL void vos_terminate (
void )

DeInitialize the vos library.
Should be called last after TRDP stack/application does not use any VOS function anymore.
Generated by Doxygen

5.39 vos_utils.h File Reference

5.39

361

vos_utils.h File Reference

Typedefs for OS abstraction.

#include 
#include 
#include "vos_types.h"
Include dependency graph for vos_utils.h:

vos_utils.h

stdio.h

stddef.h

vos_types.h

stdint.h

This graph shows which files directly or indirectly include this file:

vos_utils.h

trdp_utils.h

tau_tti.c

trdp_mdcom.c

trdp_utils.c

tau_ctrl.c

tau_dnr.c

tau_marshall.c

trdp_xml.h

tau_xml.c

trdp_xml.c

trdp_stats.h

trdp_pdcom.c

vos_mem.c

trdp_if.c

vos_utils.c

trdp_stats.c

Macros
• #define VOS_MAX_PRNT_STR_SIZE 256u
String size definitions for the debug output functions.

• #define VOS_MAX_FRMT_SIZE 64u
Max.

• #define VOS_MAX_ERR_STR_SIZE (VOS_MAX_PRNT_STR_SIZE - VOS_MAX_FRMT_SIZE)
Max.

• #define VOS_DIR_SEP '/'
This is a helper define for separating a path in debug output.

• #define vos_snprintf(str, size, format, args ...) snprintf(str, size, format, ## args) /∗lint !e586 logging output
needed ∗/
Safe printf function.

• #define vos_printLogStr(level, string)
Debug output macro without formatting options.

Generated by Doxygen

362

File Documentation

• #define vos_printLog(level, format, args ...)
Debug output macro with formatting options.

• #define ALIGNOF(type) ((UINT32)offsetof(struct { char c; type member; }, member))
Alignment macros.

• #define INITFCS 0xffffffffu
CRC/FCS constants.

• #define SIZE_OF_FCS 4u
for better understanding of address calculations

• #define L_ENDIAN
Define endianess if not already done by compiler.

Functions
• EXT_DECL UINT32 vos_crc32 (UINT32 crc, const UINT8 ∗pData, UINT32 dataLen)
Calculate CRC for the given buffer and length.

• EXT_DECL UINT32 vos_sc32 (UINT32 crc, const UINT8 ∗pData, UINT32 dataLen)
Compute crc32 according to IEC 61375-2-3 B.7 Note: Returned CRC is inverted.

• EXT_DECL VOS_ERR_T vos_init (void ∗pRefCon, VOS_PRINT_DBG_T pDebugOutput)
Initialize the vos library.

• EXT_DECL void vos_terminate (void)
DeInitialize the vos library.

• EXT_DECL const CHAR8 ∗ vos_getVersionString (void)
Return a human readable version representation.

• EXT_DECL const VOS_VERSION_T ∗ vos_getVersion (void)
Return version.

• EXT_DECL const CHAR8 ∗ vos_getErrorString (VOS_ERR_T error)
Return a human readable error representation.

5.39.1

Detailed Description

Typedefs for OS abstraction.
Note
Project: TCNOpen TRDP prototype stack

Author
Bernd Loehr, NewTec GmbH

Remarks
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL
was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. Copyright
Bombardier Transportation Inc. or its subsidiaries and others, 2013. All rights reserved.
Id
vos_utils.h 1763 2018-09-21 16:03:13Z ahweiss
BL
BL
BL
BL

2017-05-08:
2017-02-08:
2016-03-10:
2014-02-28:

Compiler warnings, doxygen comment errors
Ticket #142: Compiler warnings / MISRA-C 2012 issues
Ticket #114 SC-32
Ticket #25: CRC32 calculation is not according IEEE802.3
Generated by Doxygen

5.39 vos_utils.h File Reference

5.39.2

Macro Definition Documentation

5.39.2.1

INITFCS

#define INITFCS 0xffffffffu

CRC/FCS constants.
Initial FCS value

5.39.2.2

VOS_MAX_ERR_STR_SIZE

#define VOS_MAX_ERR_STR_SIZE (VOS_MAX_PRNT_STR_SIZE - VOS_MAX_FRMT_SIZE)

Max.
size of the error part

5.39.2.3

VOS_MAX_FRMT_SIZE

#define VOS_MAX_FRMT_SIZE 64u

Max.
size of the 'format' part

5.39.2.4

VOS_MAX_PRNT_STR_SIZE

#define VOS_MAX_PRNT_STR_SIZE 256u

String size definitions for the debug output functions.
Max. size of the debug/error string of debug function

5.39.3

Function Documentation

5.39.3.1

vos_crc32()

EXT_DECL UINT32 vos_crc32 (
UINT32 crc,
const UINT8 ∗ pData,
UINT32 dataLen )

Calculate CRC for the given buffer and length.
For TRDP FCS CRC calculation the CRC32 according to IEEE802.3 with start value 0xffffffff is used.

Generated by Doxygen

363

364

File Documentation

Parameters

in
in,out
in

crc
pData

Initial value.
Pointer to data.

dataLen

length in bytes of data.

Return values
crc32 according to
IEEE802.3

Calculate CRC for the given buffer and length.
/ to IEC 61375-2-3 A.3 Note: Returned CRC is inverted
Parameters

in
in,out
in

crc
pData

Initial value.
Pointer to data.

dataLen

length in bytes of data.

Return values
crc32 according to
IEEE802.3

5.39.3.2

vos_getErrorString()

EXT_DECL const CHAR8∗ vos_getErrorString (
VOS_ERR_T error )

Return a human readable error representation.
Parameters
in error

The TRDP or VOS error code

Return values
const string pointer to error string

5.39.3.3

vos_getVersion()

EXT_DECL const VOS_VERSION_T∗ vos_getVersion (
void )
Generated by Doxygen

5.39 vos_utils.h File Reference

Return version.
Return pointer to version structure
Return values
const VOS_VERSION←_T

Return pointer to version structure
Return values
VOS_VERSION←_T

5.39.3.4

vos_getVersionString()

EXT_DECL const CHAR8∗ vos_getVersionString (
void )

Return a human readable version representation.
Return string in the form 'v.r.u.b'
Return values
const string

5.39.3.5

vos_init()

EXT_DECL VOS_ERR_T vos_init (
void ∗ pRefCon,
VOS_PRINT_DBG_T pDebugOutput )

Initialize the vos library.
This is used to set the output function for all VOS error and debug output.
Parameters
in pRefCon

in

user context

pDebugOutput

Return values
VOS_NO_ERR
Generated by Doxygen

pointer to debug output function

no error

365

366

File Documentation

Return values
VOS_INIT_ERR

unsupported

Initialize the vos library.
Parameters
in pRefCon

in

pDebugOutput

Return values
VOS_NO_ERR

5.39.3.6

context for debug output function
Pointer to debug output function.

no error VOS_INTEGRATION_ERR if endianess/alignment mismatch VOS_SOCK_ERR
sockets not supported VOS_UNKNOWN_ERR initialisation error

vos_sc32()

EXT_DECL UINT32 vos_sc32 (
UINT32 crc,
const UINT8 ∗ pData,
UINT32 dataLen )

Compute crc32 according to IEC 61375-2-3 B.7 Note: Returned CRC is inverted.
Parameters

in
in,out
in

crc
pData

Initial value.
Pointer to data.

dataLen

length in bytes of data.

Return values
crc32 according to IEC 61375-2-3

Compute crc32 according to IEC 61375-2-3 B.7 Note: Returned CRC is inverted.
Parameters

in
in,out
in

crc
pData

Initial value.
Pointer to data.

dataLen

length in bytes of data.

Return values
sc32 according to IEC 61375-2-3

Generated by Doxygen

5.39 vos_utils.h File Reference

5.39.3.7

vos_terminate()

EXT_DECL void vos_terminate (
void

)

DeInitialize the vos library.
Should be called last after TRDP stack/application does not use any VOS function anymore.

Generated by Doxygen

367

368

File Documentation

Generated by Doxygen

Index
cnCnt
TRDP_ETB_INFO_T, 33
cnId
TRDP_FUNCTION_INFO_T, 34
confVehCnt
GNU_PACKED, 15
confVehList
GNU_PACKED, 15
cstId
TRDP_CONSIST_INFO_T, 28
cstInfoGetPropSize
tau_cstinfo.c, 68
cstList
GNU_PACKED, 15
cstOwner
TRDP_CONSIST_INFO_T, 28
cstUUID
GNU_PACKED, 15
cstVehNo
TRDP_FUNCTION_INFO_T, 35
DNS_HEADER, 9
datasetLength
GNU_PACKED, 16
destAddr
TRDP_PUB_STATISTICS_T, 47
deviceName
GNU_PACKED, 16
ETB_CTRL_COMID
iec61375-2-3.h, 64
etbId
GNU_PACKED, 16
TRDP_FUNCTION_INFO_T, 35
etbTopoCnt
GNU_PACKED, 16
fctId
TRDP_FUNCTION_INFO_T, 35
filterAddr
TRDP_SUBS_STATISTICS_T, 55
GNU_PACKED, 9
confVehCnt, 15
confVehList, 15
cstList, 15
cstUUID, 15
datasetLength, 16
deviceName, 16
etbId, 16

etbTopoCnt, 16
inhibit, 16
isLead, 17
leadDir, 17
leadVehOfCst, 17
lifesign, 17
msgType, 17
opCstList, 17
opTrnDirState, 18
opTrnTopoCnt, 18
opVehList, 18
ownOpCstNo, 18
protocolVersion, 18
reserved01, 19
reserved02, 19
reserved03, 19
reserved04, 19
reserved06, 20
safetyTrail, 20
trnCstNo, 20
trnDirState, 20
trnId, 20
trnNetDir, 21
trnOperator, 21
trnTopoCnt, 21
trnVehNo, 21
vehId, 21
vehOrient, 21
version, 22
INITFCS
vos_utils.h, 363
iec61375-2-3.h, 59
ETB_CTRL_COMID, 64
TRDP_ETBCTRL_DSID, 64
TRDP_MAX_FILE_NAME_LEN, 64
TRDP_MAX_LABEL_LEN, 64
TRDP_MAX_MD_DATA_SIZE, 64
TRDP_MAX_URI_HOST_LEN, 64
TRDP_MAX_URI_LEN, 65
TRDP_MAX_URI_USER_LEN, 65
TRDP_MD_DEFAULT_REPLY_TIMEOUT, 65
TRDP_MD_INFINITE_TIME, 65
TRDP_MIN_PD_HEADER_SIZE, 65
TRDP_MSG_PD, 65
TRDP_PD_UDP_PORT, 66
TRDP_PROCESS_DEFAULT_CYCLE_TIME, 66
TRDP_USR_URI_SIZE, 66
TTDB_NET_DIR_REQ_COMID, 66
TTDB_OP_DIR_INFO_COMID, 66

370

TTDB_STAT_CST_REQ_COMID, 66
TTDB_TRN_DIR_REQ_COMID, 67
inhibit
GNU_PACKED, 16
isLead
GNU_PACKED, 17
leadDir
GNU_PACKED, 17
leadVehOfCst
GNU_PACKED, 17
lifesign
GNU_PACKED, 17
msgType
GNU_PACKED, 17
opCstList
GNU_PACKED, 17
opTrnDirState
GNU_PACKED, 18
opTrnTopoCnt
GNU_PACKED, 18
opVehList
GNU_PACKED, 18
ownOpCstNo
GNU_PACKED, 18
PD_ELE, 22
pFrame, 24
pFrame
PD_ELE, 24
protocolVersion
GNU_PACKED, 18
reserved01
GNU_PACKED, 19
reserved02
GNU_PACKED, 19
reserved03
GNU_PACKED, 19
reserved04
GNU_PACKED, 19
reserved06
GNU_PACKED, 20
safetyTrail
GNU_PACKED, 20
TAU_MARSHALL_INFO_T, 24
TCN_URI, 25
TRDP_CLTR_CST_INFO_T, 25
TRDP_COMID_DSID_MAP_T, 26
TRDP_CONSIST_INFO_T, 26
cstId, 28
cstOwner, 28
TRDP_DATA_TYPE_T
trdp_types.h, 262
TRDP_DATASET_ELEMENT_T, 29
TRDP_DATASET, 28

INDEX

TRDP_DBG_CONFIG_T, 30
TRDP_DBG_DEFAULT
tau_xml.h, 148
TRDP_DNS_REPLY, 31
tcnUriCnt, 32
TRDP_DNS_REQUEST, 32
tcnUriCnt, 33
TRDP_ERR_T
trdp_types.h, 263
TRDP_ETB_INFO_T, 33
cnCnt, 33
TRDP_ETBCTRL_DSID
iec61375-2-3.h, 64
TRDP_EXCHG_OPTION_T
tau_xml.h, 148
TRDP_FLAGS_DEFAULT
trdp_types.h, 260
TRDP_FUNCTION_INFO_T, 34
cnId, 34
cstVehNo, 35
etbId, 35
fctId, 35
TRDP_HANDLE, 35
TRDP_IP_ADDR_T
trdp_types.h, 260
TRDP_LIST_STATISTICS_T, 36
TRDP_MARSHALL_CONFIG_T, 37
TRDP_MARSHALL_T
trdp_types.h, 260
TRDP_MAX_FILE_NAME_LEN
iec61375-2-3.h, 64
TRDP_MAX_LABEL_LEN
iec61375-2-3.h, 64
TRDP_MAX_MD_DATA_SIZE
iec61375-2-3.h, 64
TRDP_MAX_URI_HOST_LEN
iec61375-2-3.h, 64
TRDP_MAX_URI_LEN
iec61375-2-3.h, 65
TRDP_MAX_URI_USER_LEN
iec61375-2-3.h, 65
TRDP_MD_CALLBACK_T
trdp_types.h, 261
TRDP_MD_CONFIG_T, 38
TRDP_MD_DEFAULT_REPLY_TIMEOUT
iec61375-2-3.h, 65
TRDP_MD_ELE_ST_T
trdp_private.h, 245
TRDP_MD_INFINITE_TIME
iec61375-2-3.h, 65
TRDP_MD_INFO_T, 39
TRDP_MD_STATISTICS_T, 40
TRDP_MEM_CONFIG_T, 41
TRDP_MEM_STATISTICS_T, 42
TRDP_MIN_PD_HEADER_SIZE
iec61375-2-3.h, 65
TRDP_MSG_PD
iec61375-2-3.h, 65
Generated by Doxygen

INDEX

TRDP_PD_CALLBACK_T
trdp_types.h, 261
TRDP_PD_CONFIG_T, 42
TRDP_PD_INFO_T, 43
TRDP_PD_STATISTICS_T, 44
TRDP_PD_UDP_PORT
iec61375-2-3.h, 66
TRDP_PRINT_DBG_T
trdp_types.h, 261
TRDP_PROCESS_CONFIG_T, 45
TRDP_PROCESS_DEFAULT_CYCLE_TIME
iec61375-2-3.h, 66
TRDP_PROP_T, 46
TRDP_PUB_STATISTICS_T, 46
destAddr, 47
TRDP_RED_STATE_T
trdp_types.h, 264
TRDP_RED_STATISTICS_T, 47
TRDP_REPLY_STATUS_T
trdp_types.h, 264
TRDP_SDT_DEFAULT_CMTHR
tau_xml.c, 141
TRDP_SDT_PAR_T, 47
TRDP_SEND_PARAM_T, 48
TRDP_SEQ_CNT_ENTRY_T, 49
TRDP_SESSION, 49
TRDP_SOCK_TYPE_T
trdp_private.h, 245
TRDP_SOCKET_TCP, 51
TRDP_SOCKETS, 51
usage, 52
TRDP_STATISTICS_REQUEST_T, 52
TRDP_STATISTICS_T, 53
TRDP_SUBS_STATISTICS_T, 54
filterAddr, 55
timeout, 55
toBehav, 55
TRDP_TIME_T
trdp_types.h, 261
TRDP_TO_BEHAVIOR_T
trdp_types.h, 264
TRDP_UNMARSHALL_T
trdp_types.h, 261
TRDP_USR_URI_SIZE
iec61375-2-3.h, 66
TRDP_VEHICLE_INFO_T, 56
vehId, 57
TRDP_XML_DOC_HANDLE_T, 57
TTDB_NET_DIR_REQ_COMID
iec61375-2-3.h, 66
TTDB_OP_DIR_INFO_COMID
iec61375-2-3.h, 66
TTDB_STAT_CST_REQ_COMID
iec61375-2-3.h, 66
TTDB_TRN_DIR_REQ_COMID
iec61375-2-3.h, 67
TTI_CACHED_CONSISTS
tau_tti.c, 114
Generated by Doxygen

371

tau_DNRstatus
tau_dnr.c, 85
tau_dnr.h, 91
tau_addr2Uri
tau_dnr.c, 84
tau_dnr.h, 89
tau_calcDatasetSize
tau_marshall.c, 97
tau_marshall.h, 104
tau_calcDatasetSizeByComId
tau_marshall.c, 98
tau_marshall.h, 105
tau_cstinfo.c, 67
cstInfoGetPropSize, 68
tau_ctrl.c, 69
tau_getEcspStat, 71
tau_initEcspCtrl, 71
tau_requestEcspConfirm, 73
tau_setEcspCtrl, 73
tau_terminateEcspCtrl, 74
tau_ctrl.h, 74
tau_getEcspStat, 77
tau_initEcspCtrl, 77
tau_requestEcspConfirm, 78
tau_setEcspCtrl, 78
tau_terminateEcspCtrl, 79
tau_ctrl_types.h, 79
tau_deInitDnr
tau_dnr.c, 84
tau_dnr.h, 90
tau_deInitTTI
tau_tti.c, 114
tau_tti.h, 126
tau_dnr.c, 82
tau_DNRstatus, 85
tau_addr2Uri, 84
tau_deInitDnr, 84
tau_getOwnAddr, 85
tau_initDnr, 86
tau_uri2Addr, 86
tau_dnr.h, 87
tau_DNRstatus, 91
tau_addr2Uri, 89
tau_deInitDnr, 90
tau_getOwnAddr, 91
tau_initDnr, 91
tau_uri2Addr, 92
tau_dnr_types.h, 93
tau_freeTelegrams
tau_xml.c, 141
tau_xml.h, 149
tau_freeXmlDatasetConfig
tau_xml.c, 141
tau_xml.h, 149
tau_freeXmlDoc
tau_xml.c, 142
tau_xml.h, 150
tau_getCstFctCnt

372

tau_tti.c, 115
tau_tti.h, 127
tau_getCstFctInfo
tau_tti.c, 115
tau_tti.h, 127
tau_getCstInfo
tau_tti.c, 116
tau_tti.h, 128
tau_getCstVehCnt
tau_tti.c, 116
tau_tti.h, 128
tau_getEcspStat
tau_ctrl.c, 71
tau_ctrl.h, 77
tau_getOpTrDirectory
tau_tti.c, 117
tau_tti.h, 129
tau_getOpTrnDirectoryStatusInfo
tau_tti.c, 117
tau_tti.h, 130
tau_getOwnAddr
tau_dnr.c, 85
tau_dnr.h, 91
tau_getOwnIds
tau_tti.c, 117
tau_tti.h, 130
tau_getStaticCstInfo
tau_tti.c, 118
tau_tti.h, 131
tau_getTTI
tau_tti.c, 120
tau_tti.h, 133
tau_getTrDirectory
tau_tti.c, 118
tau_tti.h, 131
tau_getTrnCstCnt
tau_tti.c, 119
tau_tti.h, 132
tau_getTrnVehCnt
tau_tti.c, 119
tau_tti.h, 132
tau_getVehInfo
tau_tti.c, 120
tau_tti.h, 134
tau_getVehOrient
tau_tti.c, 121
tau_tti.h, 134
tau_initDnr
tau_dnr.c, 86
tau_dnr.h, 91
tau_initEcspCtrl
tau_ctrl.c, 71
tau_ctrl.h, 77
tau_initMarshall
tau_marshall.c, 99
tau_marshall.h, 106
tau_initTTIaccess
tau_tti.c, 121

INDEX

tau_tti.h, 135
tau_marshall
tau_marshall.c, 99
tau_marshall.h, 107
tau_marshall.c, 96
tau_calcDatasetSize, 97
tau_calcDatasetSizeByComId, 98
tau_initMarshall, 99
tau_marshall, 99
tau_marshallDs, 100
tau_unmarshall, 101
tau_unmarshallDs, 101
tau_marshall.h, 102
tau_calcDatasetSize, 104
tau_calcDatasetSizeByComId, 105
tau_initMarshall, 106
tau_marshall, 107
tau_marshallDs, 108
tau_unmarshall, 110
tau_unmarshallDs, 111
tau_marshallDs
tau_marshall.c, 100
tau_marshall.h, 108
tau_prepareXmlDoc
tau_xml.c, 142
tau_xml.h, 150
tau_readXmlDatasetConfig
tau_xml.c, 142
tau_xml.h, 151
tau_readXmlDeviceConfig
tau_xml.c, 144
tau_xml.h, 151
tau_readXmlInterfaceConfig
tau_xml.c, 144
tau_xml.h, 152
tau_requestEcspConfirm
tau_ctrl.c, 73
tau_ctrl.h, 78
tau_setEcspCtrl
tau_ctrl.c, 73
tau_ctrl.h, 78
tau_terminateEcspCtrl
tau_ctrl.c, 74
tau_ctrl.h, 79
tau_tti.c, 112
TTI_CACHED_CONSISTS, 114
tau_deInitTTI, 114
tau_getCstFctCnt, 115
tau_getCstFctInfo, 115
tau_getCstInfo, 116
tau_getCstVehCnt, 116
tau_getOpTrDirectory, 117
tau_getOpTrnDirectoryStatusInfo, 117
tau_getOwnIds, 117
tau_getStaticCstInfo, 118
tau_getTTI, 120
tau_getTrDirectory, 118
tau_getTrnCstCnt, 119
Generated by Doxygen

INDEX

tau_getTrnVehCnt, 119
tau_getVehInfo, 120
tau_getVehOrient, 121
tau_initTTIaccess, 121
tau_tti.h, 123
tau_deInitTTI, 126
tau_getCstFctCnt, 127
tau_getCstFctInfo, 127
tau_getCstInfo, 128
tau_getCstVehCnt, 128
tau_getOpTrDirectory, 129
tau_getOpTrnDirectoryStatusInfo, 130
tau_getOwnIds, 130
tau_getStaticCstInfo, 131
tau_getTTI, 133
tau_getTrDirectory, 131
tau_getTrnCstCnt, 132
tau_getTrnVehCnt, 132
tau_getVehInfo, 134
tau_getVehOrient, 134
tau_initTTIaccess, 135
tau_tti_types.h, 136
tau_unmarshall
tau_marshall.c, 101
tau_marshall.h, 110
tau_unmarshallDs
tau_marshall.c, 101
tau_marshall.h, 111
tau_uri2Addr
tau_dnr.c, 86
tau_dnr.h, 92
tau_xml.c, 139
TRDP_SDT_DEFAULT_CMTHR, 141
tau_freeTelegrams, 141
tau_freeXmlDatasetConfig, 141
tau_freeXmlDoc, 142
tau_prepareXmlDoc, 142
tau_readXmlDatasetConfig, 142
tau_readXmlDeviceConfig, 144
tau_readXmlInterfaceConfig, 144
tau_xml.h, 145
TRDP_DBG_DEFAULT, 148
TRDP_EXCHG_OPTION_T, 148
tau_freeTelegrams, 149
tau_freeXmlDatasetConfig, 149
tau_freeXmlDoc, 150
tau_prepareXmlDoc, 150
tau_readXmlDatasetConfig, 151
tau_readXmlDeviceConfig, 151
tau_readXmlInterfaceConfig, 152
tcnUriCnt
TRDP_DNS_REPLY, 32
TRDP_DNS_REQUEST, 33
timeout
TRDP_SUBS_STATISTICS_T, 55
tlc_closeSession
trdp_if.c, 157
trdp_if_light.h, 179
Generated by Doxygen

373

tlc_configSession
trdp_if.c, 158
trdp_if_light.h, 180
tlc_freeBuf
trdp_if_light.h, 181
tlc_getETBTopoCount
trdp_if.c, 158
trdp_if_light.h, 181
tlc_getInterval
trdp_if.c, 159
trdp_if_light.h, 181
tlc_getJoinStatistics
trdp_if_light.h, 182
trdp_stats.c, 247
tlc_getOpTrainTopoCount
trdp_if.c, 159
trdp_if_light.h, 183
tlc_getOwnIpAddress
trdp_if.c, 159
trdp_if_light.h, 183
tlc_getPubStatistics
trdp_if_light.h, 184
trdp_stats.c, 248
tlc_getRedStatistics
trdp_if_light.h, 185
trdp_stats.c, 248
tlc_getStatistics
trdp_if_light.h, 185
trdp_stats.c, 249
tlc_getSubsStatistics
trdp_if_light.h, 186
trdp_stats.c, 249
tlc_getTcpListStatistics
trdp_if_light.h, 187
tlc_getUdpListStatistics
trdp_if_light.h, 187
tlc_getVersion
trdp_if.c, 160
trdp_if_light.h, 188
tlc_getVersionString
trdp_if.c, 160
trdp_if_light.h, 188
tlc_init
trdp_if.c, 160
trdp_if_light.h, 189
tlc_openSession
trdp_if.c, 161
trdp_if_light.h, 190
tlc_process
trdp_if.c, 162
trdp_if_light.h, 190
tlc_reinitSession
trdp_if.c, 162
trdp_if_light.h, 191
tlc_resetStatistics
trdp_if_light.h, 191
trdp_stats.c, 250
tlc_setETBTopoCount

374

trdp_if.c, 163
trdp_if_light.h, 192
tlc_setOpTrainTopoCount
trdp_if.c, 163
trdp_if_light.h, 192
tlc_terminate
trdp_if.c, 164
trdp_if_light.h, 193
tlm_abortSession
trdp_if_light.h, 193
tlm_addListener
trdp_if_light.h, 194
tlm_confirm
trdp_if_light.h, 195
tlm_delListener
trdp_if_light.h, 195
tlm_notify
trdp_if_light.h, 196
tlm_readdListener
trdp_if_light.h, 197
tlm_reply
trdp_if_light.h, 197
tlm_replyQuery
trdp_if_light.h, 198
tlm_request
trdp_if_light.h, 199
tlp_get
trdp_if.c, 164
trdp_if_light.h, 200
tlp_getRedundant
trdp_if.c, 165
trdp_if_light.h, 201
tlp_publish
trdp_if.c, 165
trdp_if_light.h, 201
tlp_put
trdp_if.c, 166
trdp_if_light.h, 202
tlp_republish
trdp_if.c, 167
trdp_if_light.h, 203
tlp_request
trdp_if.c, 167
trdp_if_light.h, 204
tlp_resubscribe
trdp_if.c, 168
trdp_if_light.h, 206
tlp_setRedundant
trdp_if.c, 169
trdp_if_light.h, 207
tlp_subscribe
trdp_if.c, 169
trdp_if_light.h, 207
tlp_unpublish
trdp_if.c, 170
trdp_if_light.h, 209
tlp_unsubscribe
trdp_if.c, 171

INDEX

trdp_if_light.h, 210
toBehav
TRDP_SUBS_STATISTICS_T, 55
trdp_UpdateStats
trdp_stats.c, 251
trdp_XMLClose
trdp_xml.c, 291
trdp_xml.h, 297
trdp_XMLCountStartTag
trdp_xml.c, 292
trdp_xml.h, 297
trdp_XMLEnter
trdp_xml.c, 292
trdp_xml.h, 298
trdp_XMLGetAttribute
trdp_xml.c, 292
trdp_xml.h, 298
trdp_XMLLeave
trdp_xml.c, 293
trdp_xml.h, 298
trdp_XMLOpen
trdp_xml.c, 293
trdp_xml.h, 299
trdp_XMLRewind
trdp_xml.c, 294
trdp_xml.h, 299
trdp_XMLSeekStartTag
trdp_xml.c, 294
trdp_xml.h, 299
trdp_XMLSeekStartTagAny
trdp_xml.c, 294
trdp_xml.h, 300
trdp_checkSequenceCounter
trdp_utils.c, 267
trdp_utils.h, 279
trdp_dllmain.c, 153
trdp_findMCjoins
trdp_utils.c, 268
trdp_utils.h, 280
trdp_getCurrentMaxSocketCnt
trdp_utils.c, 268
trdp_utils.h, 280
trdp_getSeqCnt
trdp_utils.c, 268
trdp_utils.h, 281
trdp_if.c, 154
tlc_closeSession, 157
tlc_configSession, 158
tlc_getETBTopoCount, 158
tlc_getInterval, 159
tlc_getOpTrainTopoCount, 159
tlc_getOwnIpAddress, 159
tlc_getVersion, 160
tlc_getVersionString, 160
tlc_init, 160
tlc_openSession, 161
tlc_process, 162
tlc_reinitSession, 162
Generated by Doxygen

INDEX

tlc_setETBTopoCount, 163
tlc_setOpTrainTopoCount, 163
tlc_terminate, 164
tlp_get, 164
tlp_getRedundant, 165
tlp_publish, 165
tlp_put, 166
tlp_republish, 167
tlp_request, 167
tlp_resubscribe, 168
tlp_setRedundant, 169
tlp_subscribe, 169
tlp_unpublish, 170
tlp_unsubscribe, 171
trdp_isValidSession, 171
trdp_sessionQueue, 172
trdp_if.h, 172
trdp_isValidSession, 174
trdp_sessionQueue, 175
trdp_if_light.h, 175
tlc_closeSession, 179
tlc_configSession, 180
tlc_freeBuf, 181
tlc_getETBTopoCount, 181
tlc_getInterval, 181
tlc_getJoinStatistics, 182
tlc_getOpTrainTopoCount, 183
tlc_getOwnIpAddress, 183
tlc_getPubStatistics, 184
tlc_getRedStatistics, 185
tlc_getStatistics, 185
tlc_getSubsStatistics, 186
tlc_getTcpListStatistics, 187
tlc_getUdpListStatistics, 187
tlc_getVersion, 188
tlc_getVersionString, 188
tlc_init, 189
tlc_openSession, 190
tlc_process, 190
tlc_reinitSession, 191
tlc_resetStatistics, 191
tlc_setETBTopoCount, 192
tlc_setOpTrainTopoCount, 192
tlc_terminate, 193
tlm_abortSession, 193
tlm_addListener, 194
tlm_confirm, 195
tlm_delListener, 195
tlm_notify, 196
tlm_readdListener, 197
tlm_reply, 197
tlm_replyQuery, 198
tlm_request, 199
tlp_get, 200
tlp_getRedundant, 201
tlp_publish, 201
tlp_put, 202
tlp_republish, 203
Generated by Doxygen

375

tlp_request, 204
tlp_resubscribe, 206
tlp_setRedundant, 207
tlp_subscribe, 207
tlp_unpublish, 209
tlp_unsubscribe, 210
trdp_initSockets
trdp_utils.c, 269
trdp_utils.h, 281
trdp_initStats
trdp_stats.c, 250
trdp_stats.h, 253
trdp_initUncompletedTCP
trdp_utils.h, 282
trdp_isAddressed
trdp_utils.c, 269
trdp_utils.h, 282
trdp_isInIPrange
trdp_utils.c, 270
trdp_utils.h, 282
trdp_isValidSession
trdp_if.c, 171
trdp_if.h, 174
trdp_mdCall
trdp_mdcom.c, 213
trdp_mdcom.h, 220
trdp_mdCheckListenSocks
trdp_mdcom.c, 214
trdp_mdcom.h, 221
trdp_mdCheckPending
trdp_mdcom.c, 214
trdp_mdcom.h, 221
trdp_mdCheckTimeouts
trdp_mdcom.c, 214
trdp_mdcom.h, 221
trdp_mdConfirm
trdp_mdcom.c, 215
trdp_mdcom.h, 222
trdp_mdFreeSession
trdp_mdcom.c, 215
trdp_mdcom.h, 222
trdp_mdGetTCPSocket
trdp_mdcom.c, 216
trdp_mdcom.h, 223
trdp_mdReply
trdp_mdcom.c, 216
trdp_mdcom.h, 223
trdp_mdSend
trdp_mdcom.c, 217
trdp_mdcom.h, 224
trdp_mdcom.c, 210
trdp_mdCall, 213
trdp_mdCheckListenSocks, 214
trdp_mdCheckPending, 214
trdp_mdCheckTimeouts, 214
trdp_mdConfirm, 215
trdp_mdFreeSession, 215
trdp_mdGetTCPSocket, 216

376

trdp_mdReply, 216
trdp_mdSend, 217
trdp_mdcom.h, 217
trdp_mdCall, 220
trdp_mdCheckListenSocks, 221
trdp_mdCheckPending, 221
trdp_mdCheckTimeouts, 221
trdp_mdConfirm, 222
trdp_mdFreeSession, 222
trdp_mdGetTCPSocket, 223
trdp_mdReply, 223
trdp_mdSend, 224
trdp_packetSizeMD
trdp_utils.c, 270
trdp_utils.h, 284
trdp_packetSizePD
trdp_utils.c, 270
trdp_utils.h, 284
trdp_pdCheck
trdp_pdcom.c, 227
trdp_pdcom.h, 235
trdp_pdCheckListenSocks
trdp_pdcom.c, 227
trdp_pdcom.h, 235
trdp_pdCheckPending
trdp_pdcom.c, 228
trdp_pdcom.h, 236
trdp_pdDistribute
trdp_pdcom.c, 228
trdp_pdcom.h, 236
trdp_pdHandleTimeOuts
trdp_pdcom.c, 229
trdp_pdcom.h, 237
trdp_pdInit
trdp_pdcom.c, 229
trdp_pdcom.h, 238
trdp_pdPrepareStats
trdp_stats.c, 251
trdp_stats.h, 254
trdp_pdPut
trdp_pdcom.c, 230
trdp_pdcom.h, 238
trdp_pdReceive
trdp_pdcom.c, 231
trdp_pdcom.h, 239
trdp_pdSend
trdp_pdcom.c, 231
trdp_pdcom.h, 240
trdp_pdSendQueued
trdp_pdcom.c, 232
trdp_pdcom.h, 240
trdp_pdUpdate
trdp_pdcom.c, 232
trdp_pdcom.h, 241
trdp_pdcom.c, 224
trdp_pdCheck, 227
trdp_pdCheckListenSocks, 227
trdp_pdCheckPending, 228

INDEX

trdp_pdDistribute, 228
trdp_pdHandleTimeOuts, 229
trdp_pdInit, 229
trdp_pdPut, 230
trdp_pdReceive, 231
trdp_pdSend, 231
trdp_pdSendQueued, 232
trdp_pdUpdate, 232
trdp_pdcom.h, 233
trdp_pdCheck, 235
trdp_pdCheckListenSocks, 235
trdp_pdCheckPending, 236
trdp_pdDistribute, 236
trdp_pdHandleTimeOuts, 237
trdp_pdInit, 238
trdp_pdPut, 238
trdp_pdReceive, 239
trdp_pdSend, 240
trdp_pdSendQueued, 240
trdp_pdUpdate, 241
trdp_private.h, 241
TRDP_MD_ELE_ST_T, 245
TRDP_SOCK_TYPE_T, 245
trdp_queueAppLast
trdp_utils.c, 271
trdp_utils.h, 285
trdp_queueDelElement
trdp_utils.c, 271
trdp_utils.h, 285
trdp_queueFindComId
trdp_utils.c, 271
trdp_utils.h, 285
trdp_queueFindPubAddr
trdp_utils.c, 273
trdp_utils.h, 286
trdp_queueFindSubAddr
trdp_utils.c, 273
trdp_utils.h, 286
trdp_queueInsFirst
trdp_utils.c, 274
trdp_utils.h, 287
trdp_releaseSocket
trdp_utils.c, 274
trdp_utils.h, 287
trdp_requestSocket
trdp_utils.c, 274
trdp_utils.h, 288
trdp_resetSequenceCounter
trdp_utils.c, 275
trdp_utils.h, 289
trdp_sessionQueue
trdp_if.c, 172
trdp_if.h, 175
trdp_stats.c, 245
tlc_getJoinStatistics, 247
tlc_getPubStatistics, 248
tlc_getRedStatistics, 248
tlc_getStatistics, 249
Generated by Doxygen

INDEX

tlc_getSubsStatistics, 249
tlc_resetStatistics, 250
trdp_UpdateStats, 251
trdp_initStats, 250
trdp_pdPrepareStats, 251
trdp_stats.h, 252
trdp_initStats, 253
trdp_pdPrepareStats, 254
trdp_types.h, 254
TRDP_DATA_TYPE_T, 262
TRDP_ERR_T, 263
TRDP_FLAGS_DEFAULT, 260
TRDP_IP_ADDR_T, 260
TRDP_MARSHALL_T, 260
TRDP_MD_CALLBACK_T, 261
TRDP_PD_CALLBACK_T, 261
TRDP_PRINT_DBG_T, 261
TRDP_RED_STATE_T, 264
TRDP_REPLY_STATUS_T, 264
TRDP_TIME_T, 261
TRDP_TO_BEHAVIOR_T, 264
TRDP_UNMARSHALL_T, 261
trdp_utils.c, 265
trdp_checkSequenceCounter, 267
trdp_findMCjoins, 268
trdp_getCurrentMaxSocketCnt, 268
trdp_getSeqCnt, 268
trdp_initSockets, 269
trdp_isAddressed, 269
trdp_isInIPrange, 270
trdp_packetSizeMD, 270
trdp_packetSizePD, 270
trdp_queueAppLast, 271
trdp_queueDelElement, 271
trdp_queueFindComId, 271
trdp_queueFindPubAddr, 273
trdp_queueFindSubAddr, 273
trdp_queueInsFirst, 274
trdp_releaseSocket, 274
trdp_requestSocket, 274
trdp_resetSequenceCounter, 275
trdp_validTopoCounters, 276
trdp_utils.h, 276
trdp_checkSequenceCounter, 279
trdp_findMCjoins, 280
trdp_getCurrentMaxSocketCnt, 280
trdp_getSeqCnt, 281
trdp_initSockets, 281
trdp_initUncompletedTCP, 282
trdp_isAddressed, 282
trdp_isInIPrange, 282
trdp_packetSizeMD, 284
trdp_packetSizePD, 284
trdp_queueAppLast, 285
trdp_queueDelElement, 285
trdp_queueFindComId, 285
trdp_queueFindPubAddr, 286
trdp_queueFindSubAddr, 286
Generated by Doxygen

377

trdp_queueInsFirst, 287
trdp_releaseSocket, 287
trdp_requestSocket, 288
trdp_resetSequenceCounter, 289
trdp_validTopoCounters, 289
trdp_validTopoCounters
trdp_utils.c, 276
trdp_utils.h, 289
trdp_xml.c, 290
trdp_XMLClose, 291
trdp_XMLCountStartTag, 292
trdp_XMLEnter, 292
trdp_XMLGetAttribute, 292
trdp_XMLLeave, 293
trdp_XMLOpen, 293
trdp_XMLRewind, 294
trdp_XMLSeekStartTag, 294
trdp_XMLSeekStartTagAny, 294
trdp_xml.h, 295
trdp_XMLClose, 297
trdp_XMLCountStartTag, 297
trdp_XMLEnter, 298
trdp_XMLGetAttribute, 298
trdp_XMLLeave, 298
trdp_XMLOpen, 299
trdp_XMLRewind, 299
trdp_XMLSeekStartTag, 299
trdp_XMLSeekStartTagAny, 300
trnCstNo
GNU_PACKED, 20
trnDirState
GNU_PACKED, 20
trnId
GNU_PACKED, 20
trnNetDir
GNU_PACKED, 21
trnOperator
GNU_PACKED, 21
trnTopoCnt
GNU_PACKED, 21
trnVehNo
GNU_PACKED, 21
usage
TRDP_SOCKETS, 52
VOS_ERR_T
vos_types.h, 355
VOS_LOG_T
vos_types.h, 356
VOS_MAX_ERR_STR_SIZE
vos_utils.h, 363
VOS_MAX_FRMT_SIZE
vos_utils.h, 363
VOS_MAX_PRNT_STR_SIZE
vos_utils.h, 363
VOS_MAX_SOCKET_CNT
vos_sock.h, 325
VOS_MEM_BLOCKSIZES

378

vos_mem.h, 311
VOS_MEM_PREALLOCATE
vos_mem.h, 312
VOS_PRINT_DBG_T
vos_types.h, 355
VOS_SOCK_OPT_T, 57
VOS_TIMEVAL_T
vos_types.h, 355
VOS_TTL_MULTICAST
vos_sock.h, 325
VOS_VERSION_T, 58
vehId
GNU_PACKED, 21
TRDP_VEHICLE_INFO_T, 57
vehOrient
GNU_PACKED, 21
version
GNU_PACKED, 22
vos_addTime
vos_thread.h, 342
vos_bsearch
vos_mem.c, 302
vos_mem.h, 312
vos_clearTime
vos_thread.h, 342
vos_cmpTime
vos_thread.h, 342
vos_crc32
vos_utils.c, 358
vos_utils.h, 363
vos_cyclicThread
vos_thread.h, 344
vos_determineBindAddr
vos_sock.h, 325
vos_divTime
vos_thread.h, 344
vos_dottedIP
vos_sock.h, 326
vos_getErrorString
vos_utils.c, 358
vos_utils.h, 364
vos_getInterfaces
vos_sock.h, 326
vos_getTime
vos_thread.h, 345
vos_getTimeStamp
vos_thread.h, 345
vos_getUuid
vos_thread.h, 345
vos_getVersion
vos_utils.c, 359
vos_utils.h, 364
vos_getVersionString
vos_utils.c, 359
vos_utils.h, 365
vos_htonl
vos_sock.h, 327
vos_htonll

INDEX

vos_sock.h, 327
vos_htons
vos_sock.h, 327
vos_init
vos_utils.c, 359
vos_utils.h, 365
vos_ipDotted
vos_sock.h, 328
vos_isMulticast
vos_sock.h, 328
vos_mem.c, 300
vos_bsearch, 302
vos_memAlloc, 303
vos_memCount, 303
vos_memDelete, 304
vos_memFree, 304
vos_memInit, 304
vos_qsort, 305
vos_queueCreate, 305
vos_queueDestroy, 306
vos_queueReceive, 306
vos_queueSend, 307
vos_strncat, 308
vos_strncpy, 308
vos_strnicmp, 308
vos_mem.h, 309
VOS_MEM_BLOCKSIZES, 311
VOS_MEM_PREALLOCATE, 312
vos_bsearch, 312
vos_memAlloc, 313
vos_memCount, 313
vos_memDelete, 314
vos_memFree, 314
vos_memInit, 314
vos_qsort, 315
vos_queueCreate, 316
vos_queueDestroy, 316
vos_queueReceive, 317
vos_queueSend, 317
vos_strncat, 318
vos_strncpy, 318
vos_strnicmp, 319
vos_memAlloc
vos_mem.c, 303
vos_mem.h, 313
vos_memCount
vos_mem.c, 303
vos_mem.h, 313
vos_memDelete
vos_mem.c, 304
vos_mem.h, 314
vos_memFree
vos_mem.c, 304
vos_mem.h, 314
vos_memInit
vos_mem.c, 304
vos_mem.h, 314
vos_mulTime
Generated by Doxygen

INDEX

vos_thread.h, 345
vos_mutexCreate
vos_thread.h, 346
vos_mutexDelete
vos_thread.h, 346
vos_mutexLock
vos_thread.h, 346
vos_mutexTryLock
vos_thread.h, 347
vos_mutexUnlock
vos_thread.h, 347
vos_netIfUp
vos_sock.h, 328
vos_ntohl
vos_sock.h, 329
vos_ntohll
vos_sock.h, 329
vos_ntohs
vos_sock.h, 330
vos_qsort
vos_mem.c, 305
vos_mem.h, 315
vos_queueCreate
vos_mem.c, 305
vos_mem.h, 316
vos_queueDestroy
vos_mem.c, 306
vos_mem.h, 316
vos_queueReceive
vos_mem.c, 306
vos_mem.h, 317
vos_queueSend
vos_mem.c, 307
vos_mem.h, 317
vos_sc32
vos_utils.c, 360
vos_utils.h, 366
vos_select
vos_sock.h, 330
vos_semaCreate
vos_thread.h, 348
vos_semaDelete
vos_thread.h, 348
vos_semaGive
vos_thread.h, 348
vos_semaTake
vos_thread.h, 349
vos_shared_mem.h, 319
vos_sharedClose, 321
vos_sharedOpen, 321
vos_sharedClose
vos_shared_mem.h, 321
vos_sharedOpen
vos_shared_mem.h, 321
vos_sock.h, 322
VOS_MAX_SOCKET_CNT, 325
VOS_TTL_MULTICAST, 325
vos_determineBindAddr, 325
Generated by Doxygen

379

vos_dottedIP, 326
vos_getInterfaces, 326
vos_htonl, 327
vos_htonll, 327
vos_htons, 327
vos_ipDotted, 328
vos_isMulticast, 328
vos_netIfUp, 328
vos_ntohl, 329
vos_ntohll, 329
vos_ntohs, 330
vos_select, 330
vos_sockAccept, 330
vos_sockBind, 331
vos_sockClose, 331
vos_sockConnect, 332
vos_sockGetMAC, 332
vos_sockInit, 333
vos_sockJoinMC, 333
vos_sockLeaveMC, 333
vos_sockListen, 334
vos_sockOpenTCP, 334
vos_sockOpenUDP, 335
vos_sockReceiveTCP, 335
vos_sockReceiveUDP, 336
vos_sockSendTCP, 337
vos_sockSendUDP, 337
vos_sockSetMulticastIf, 338
vos_sockSetOptions, 338
vos_sockTerm, 339
vos_sockAccept
vos_sock.h, 330
vos_sockBind
vos_sock.h, 331
vos_sockClose
vos_sock.h, 331
vos_sockConnect
vos_sock.h, 332
vos_sockGetMAC
vos_sock.h, 332
vos_sockInit
vos_sock.h, 333
vos_sockJoinMC
vos_sock.h, 333
vos_sockLeaveMC
vos_sock.h, 333
vos_sockListen
vos_sock.h, 334
vos_sockOpenTCP
vos_sock.h, 334
vos_sockOpenUDP
vos_sock.h, 335
vos_sockReceiveTCP
vos_sock.h, 335
vos_sockReceiveUDP
vos_sock.h, 336
vos_sockSendTCP
vos_sock.h, 337

380

vos_sockSendUDP
vos_sock.h, 337
vos_sockSetMulticastIf
vos_sock.h, 338
vos_sockSetOptions
vos_sock.h, 338
vos_sockTerm
vos_sock.h, 339
vos_strncat
vos_mem.c, 308
vos_mem.h, 318
vos_strncpy
vos_mem.c, 308
vos_mem.h, 318
vos_strnicmp
vos_mem.c, 308
vos_mem.h, 319
vos_subTime
vos_thread.h, 349
vos_terminate
vos_utils.c, 360
vos_utils.h, 366
vos_thread.h, 339
vos_addTime, 342
vos_clearTime, 342
vos_cmpTime, 342
vos_cyclicThread, 344
vos_divTime, 344
vos_getTime, 345
vos_getTimeStamp, 345
vos_getUuid, 345
vos_mulTime, 345
vos_mutexCreate, 346
vos_mutexDelete, 346
vos_mutexLock, 346
vos_mutexTryLock, 347
vos_mutexUnlock, 347
vos_semaCreate, 348
vos_semaDelete, 348
vos_semaGive, 348
vos_semaTake, 349
vos_subTime, 349
vos_threadCreate, 349
vos_threadDelay, 350
vos_threadInit, 351
vos_threadIsActive, 351
vos_threadSelf, 351
vos_threadTerm, 352
vos_threadTerminate, 352
vos_threadCreate
vos_thread.h, 349
vos_threadDelay
vos_thread.h, 350
vos_threadInit
vos_thread.h, 351
vos_threadIsActive
vos_thread.h, 351
vos_threadSelf

INDEX

vos_thread.h, 351
vos_threadTerm
vos_thread.h, 352
vos_threadTerminate
vos_thread.h, 352
vos_types.h, 352
VOS_ERR_T, 355
VOS_LOG_T, 356
VOS_PRINT_DBG_T, 355
VOS_TIMEVAL_T, 355
vos_utils.c, 356
vos_crc32, 358
vos_getErrorString, 358
vos_getVersion, 359
vos_getVersionString, 359
vos_init, 359
vos_sc32, 360
vos_terminate, 360
vos_utils.h, 361
INITFCS, 363
VOS_MAX_ERR_STR_SIZE, 363
VOS_MAX_FRMT_SIZE, 363
VOS_MAX_PRNT_STR_SIZE, 363
vos_crc32, 363
vos_getErrorString, 364
vos_getVersion, 364
vos_getVersionString, 365
vos_init, 365
vos_sc32, 366
vos_terminate, 366

Generated by Doxygen



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : No
Page Count                      : 406
Page Mode                       : UseOutlines
Author                          : 
Title                           : 
Subject                         : 
Creator                         : LaTeX with hyperref package
Producer                        : pdfTeX-1.40.19
Create Date                     : 2018:11:07 11:08:33+01:00
Modify Date                     : 2018:11:07 11:08:33+01:00
Trapped                         : False
PTEX Fullbanner                 : This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) kpathsea version 6.3.0
EXIF Metadata provided by EXIF.tools

Navigation menu