HP 800 ACSE/Presentation and ROSE Interface Programmer's Guide - Page 49

Manage the A/P Environment

Page 49 highlights

Programming Guide 2. Manage the A/P Environment 2. Manage the A/P Environment The ACSE/Presentation environment contains the necessary information to establish and maintain an association. The primitives used to identify this information are called attributes. See Appendix A, "AP_ENV Table of Attributes" which describes the states and whether or not particular attributes can be written to or read from. Three A/P calls are used to manage information in the A/P environment: • ap_init_env() establishes the environment and sets up default values for many of the attributes. Note that the env_file variable in ap_init_env() is ignored. Refer to the manpage for ap_env() for the attribute default values. • ap_set_env() is used to change a value of the specified attribute. To change a list of attributes, you must use multiple ap_set_env() calls (one for each attribute changed) • ap_get_env() is used to read a value of a specified attribute. When you use ap_get_env() for attributes which are stored as data structures, memory is allocated for you. When you have finished using the information from the data structure, must use ap_free() to free the memory. For memory allocated by your application, do not use ap_free(). Implement your own routines to free application-created memory allocations. A partial list of A/P attributes used that require allocating and deallocating memory are: AP_PCDL, AP_PCDRL, and AP_LCL_PADDR. Determine Initiator and Responder Roles When you create your programs, decide which process will be initiating and which one will be accepting associations. By default, both processes may initiate and respond to a request. The roles are set using the AP_ROLE_ALLOWED environment attribute. However, when one process issues a connection request, it is established as the initiator and may no longer receive connection indications. The AP_ROLE_CURRENT is set to AP_INITIATOR. Chapter 4 49

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109

Chapter 4
49
Programming Guide
2. Manage the A/P Environment
2. Manage the A/P Environment
The ACSE/Presentation environment contains the necessary information
to establish and maintain an association. The primitives used to identify
this information are called attributes. See Appendix A, “AP_ENV Table
of Attributes” which describes the states and whether or not particular
attributes can be written to or read from.
Three A/P calls are used to manage information in the A/P environment:
ap_init_env() establishes the environment and sets up default values
for many of the attributes. Note that the env_file variable in
ap_init_env() is ignored. Refer to the manpage for ap_env() for the
attribute default values.
ap_set_env() is used to change a value of the specified attribute. To
change a list of attributes, you must use multiple ap_set_env() calls
(one for each attribute changed)
ap_get_env() is used to read a value of a specified attribute.
When you use ap_get_env() for attributes which are stored as data
structures, memory is allocated for you. When you have finished using
the information from the data structure, must use ap_free() to free the
memory.
For memory allocated by your application, do not use ap_free().
Implement your own routines to free application-created memory
allocations.
A partial list of A/P attributes used that require allocating and
deallocating memory are: AP_PCDL, AP_PCDRL, and AP_LCL_PADDR.
Determine Initiator and Responder Roles
When you create your programs, decide which process will be initiating
and which one will be accepting associations.
By default, both processes may initiate and respond to a request. The
roles are set using the AP_ROLE_ALLOWED environment attribute.
However, when one process issues a connection request, it is established
as the initiator and may no longer receive connection indications. The
AP_ROLE_CURRENT is set to AP_INITIATOR.