| 1 | .\" Copyright (c) 2005-2008 David Carter <dcarter@arm4.org> and others. |
|---|
| 2 | .\" All rights reserved. This program and the accompanying materials |
|---|
| 3 | .\" are made available under the terms of the Eclipse Public License v1.0 |
|---|
| 4 | .\" which accompanies this distribution, and is available at |
|---|
| 5 | .\" http://www.eclipse.org/legal/epl-v10.html |
|---|
| 6 | .TH "arm_register_application" 3 "August 2008" "arm4.org" "ARM 4 Programmer's Manual" |
|---|
| 7 | .SH NAME |
|---|
| 8 | arm_register_application \- describe application |
|---|
| 9 | .SH SYNOPSIS |
|---|
| 10 | .B #include <arm4.h> |
|---|
| 11 | .sp |
|---|
| 12 | \fBarm_error_t |
|---|
| 13 | .br |
|---|
| 14 | arm_register_application( |
|---|
| 15 | .br |
|---|
| 16 | const arm_char_t *\fIapp_name\fB, |
|---|
| 17 | .br |
|---|
| 18 | const arm_id_t *\fIinput_app_id\fB, |
|---|
| 19 | .br |
|---|
| 20 | const arm_int32_t \fIflags\fB, |
|---|
| 21 | .br |
|---|
| 22 | const arm_buffer4_t *\fIbuffer4\fB, |
|---|
| 23 | .br |
|---|
| 24 | arm_id_t *\fIoutput_app_id\fB);\fR |
|---|
| 25 | .SH DESCRIPTION |
|---|
| 26 | \fBarm_register_application()\fR describes metadata about an application. |
|---|
| 27 | |
|---|
| 28 | The application uses \fBarm_register_application()\fR to inform the ARM library of metadata about |
|---|
| 29 | the application. This metadata does not change from one application instance to another. It |
|---|
| 30 | contains part of the function of the ARM 2.0 call \fBarm_init()\fR; \fBarm_start_application()\fR contains |
|---|
| 31 | the other part. |
|---|
| 32 | |
|---|
| 33 | ARM generates an ID that is passed in \fBarm_register_transaction()\fR and \fBarm_start_application()\fR. |
|---|
| 34 | |
|---|
| 35 | \fIapp_name\fR is a pointer to a null-terminated string containing the name of the application. The |
|---|
| 36 | maximum length of the name is 128 characters, including the termination character. |
|---|
| 37 | It serves no purpose and is illegal to make this call if the pointer is null. A name |
|---|
| 38 | should be chosen that is unique, so generic names that might be used by a different |
|---|
| 39 | development team, such as "Payroll Application", should not be used. The name |
|---|
| 40 | should not contain trailing blank characters or consist of only blank characters. If |
|---|
| 41 | the application has a copyrighted product name, the copyrighted name would be a |
|---|
| 42 | good choice. |
|---|
| 43 | |
|---|
| 44 | \fIbuffer4\fR is a pointer to the user data buffer, if any. If the pointer is null (\fBARM_BUF4_NONE\fR), |
|---|
| 45 | there is no buffer. The sub-buffer formats that might be used are |
|---|
| 46 | \fBarm_subbuffer_app_identity_t\fR and \fBarm_subbuffer_encoding_t\fR. |
|---|
| 47 | |
|---|
| 48 | \fIflags\fR contains 32-bit flags. No values are currently defined. The field should be zero |
|---|
| 49 | (\fBARM_FLAG_NONE\fR). |
|---|
| 50 | |
|---|
| 51 | \fIinput_app_id\fR is a pointer to an optional 128-bit ID (16 bytes) that is unique and that can be treated as |
|---|
| 52 | an alias for the other metadata. It can be any value except all zeros or all ones. If the |
|---|
| 53 | pointer is null (\fBARM_ID_NONE\fR), no ID is provided. |
|---|
| 54 | |
|---|
| 55 | An ID is unique if the probability of the ID being associated with more than one set |
|---|
| 56 | of metadata is vanishingly small. The selection of 128-bit IDs yields 3.4 x 10**38 |
|---|
| 57 | unique IDs, so the objective is to select an ID that makes use of all 128 bits and is |
|---|
| 58 | reasonably likely to not be selected by another person creating an ID of the same |
|---|
| 59 | form. Two suggested algorithms that generate 128-bit values with these |
|---|
| 60 | characteristics are: |
|---|
| 61 | |
|---|
| 62 | .IP 1. |
|---|
| 63 | The Universal Unique Identifier (UUID) algorithm that is part of The Open |
|---|
| 64 | Group specification: DCE 1.1: Remote Procedure Call. A developer could use the |
|---|
| 65 | algorithm at the time the application is developed using a utility on his or her |
|---|
| 66 | system, and be reasonably certain that nobody else would generate the same 128-bit |
|---|
| 67 | ID. |
|---|
| 68 | |
|---|
| 69 | .IP 2. |
|---|
| 70 | The MD5 Message-Digest Algorithm, described in IETF RFC 1321. Applying |
|---|
| 71 | this algorithm to a concatenation of all the metadata properties would almost |
|---|
| 72 | certainly result in a value that would not collide with any other ID created with a |
|---|
| 73 | different set of metadata properties. |
|---|
| 74 | .P |
|---|
| 75 | If an ARM implementation is passed an ID that was previously registered within |
|---|
| 76 | this process, the implementation can ignore the other metadata parameters and |
|---|
| 77 | assume they are identical to the previously registered metadata. The application |
|---|
| 78 | metadata consists of the following fields: \fIapp_name\fR and the |
|---|
| 79 | \fBarm_subbuffer_app_identity_t\fR sub-buffer passed in \fIbuffer4\fR. |
|---|
| 80 | |
|---|
| 81 | \fIoutput_app_id\fR is a pointer to a 16-byte field. ARM will store a 16-byte value. There are no |
|---|
| 82 | requirements on what value it is set to, except that it must be possible to pass it on |
|---|
| 83 | other calls, such as \fBarm_start_application()\fR, without the application needing to do |
|---|
| 84 | any error checking. |
|---|
| 85 | .SH "RETURN VALUE" |
|---|
| 86 | On success, the function returns \fBARM_SUCCESS\fR. A non-zero value indicates |
|---|
| 87 | an error. |
|---|
| 88 | .SH ERRORS |
|---|
| 89 | If the return code is negative, an error occurred. If the return code is not negative, an error may |
|---|
| 90 | or may not have occurred - the determination of what is an error and whether an error code is |
|---|
| 91 | returned is at the discretion of the ARM implementation. The application can test the return code |
|---|
| 92 | if it wants to provide its own error logging. |
|---|
| 93 | |
|---|
| 94 | The following errors are recognized by this implementation, but may not be portable to other implementations: |
|---|
| 95 | |
|---|
| 96 | .TP |
|---|
| 97 | .B ARM_FAILURE_NULL_ARGUMENT |
|---|
| 98 | The \fIoutput_app_id\fR must not be null. |
|---|
| 99 | .TP |
|---|
| 100 | .B ARM_FAILURE_INVALID_ARGUMENT |
|---|
| 101 | The \fIapp_name\fR parameter is invalid. |
|---|
| 102 | .TP |
|---|
| 103 | .B ARM_FAILURE_UNSUPPORTED_CHARSET |
|---|
| 104 | The character set value passed in as a \fBarm_subbuffer_encoding_t\fR isn't supported. |
|---|
| 105 | .TP |
|---|
| 106 | .B ARM_FAILURE_BAD_ALIAS |
|---|
| 107 | The alias provided contains all 0's or all 1's. |
|---|
| 108 | .TP |
|---|
| 109 | .B ARM_FAILURE_DUPLICATE_ALIAS |
|---|
| 110 | The alias provided already refers to an application with different metadata. |
|---|
| 111 | .TP |
|---|
| 112 | .B ARM_FAILURE_INTERNAL_ERROR |
|---|
| 113 | An internal error has occurred that prevented the application from being registered. Check your |
|---|
| 114 | system log for more details. |
|---|
| 115 | .SH "CONFORMING TO" |
|---|
| 116 | ARM Issue 4.0 C Language Bindings, Version 2 |
|---|
| 117 | .SH EXAMPLE |
|---|
| 118 | None. |
|---|
| 119 | .SH "SEE ALSO" |
|---|
| 120 | .BR arm_destroy_application (3), |
|---|
| 121 | .BR arm_register_transaction (3), |
|---|
| 122 | .BR arm_start_application (3) |
|---|