What should be the contents of OSI CCR atomic action identifier? - standards

X/Open XA specification defines a transaction identifier for both recognizing transaction ID and making them unique.
One of the recommendation is to use OSI CCR atomic action identifier for this purpose.
The atomic action identifier is defined, according to X/Open spec, by ISO/IEC 9804.3 (1989). That ISO spec doesn't seem to be around anymore, ISO's own website won't even find it.
I found ITU X.852 that seems to define atomic action identifiers, but doesn't go into any detail what the contents should be (besides being unique).
So far, my web crawling really seems to be a dead end, so I was wondering if anybody had any information on what are the OSI CCR contents supposed to be, or whether I'm better off coming up with my own format ID, and generating some reasonable transaction IDs that make sense for my application.

I was searching for the same topic and the best information I found was in "ACSE/Presentation: Transaction Processing API (XAP-TP)"
1.3.19 Atomic Action Identifiers
OSI TP uses CCR Atomic Action Identifiers (AAIds) to identify uniquely a provider-supported distributed transaction. The AAId applies to the entire transaction tree. So, each transaction branch of the tree has the same AAId. The AAId is formed from the Application Entity Title (AET) of the originator of the transaction and a suffix unique within the scope of the AET.
Note: The AAId must be globally unique.
As far as I understand it says that OSI-CCR identifier has a prefix (unique among applications) and a suffix (some kind of counter/id). I don't think the original document goes into more details.
I'm using an algorithm based on Twitter's Snowflake (https://github.com/twitter-archive/snowflake/tree/b3f6a3c6ca8e1b6847baa6ff42bf72201e2c2231) that gives me a unique 64bit number.

For anyone coming across this in the future, the answer is entirely given within public standards. X.852 gives the following ASN.1 definition
CCR { joint-iso-itu-t ccr(7) module(1) ccr-apdus1(1) version3(3) }
DEFINITIONS IMPLICIT TAGS ::=
BEGIN
EXPORTS ... ;
IMPORTS
AE-title
FROM ACSE-1 { joint-iso-itu-t association-control(2) module(2) apdus(1) version1(1) };
-- ASN.1 module defined in ITU-T Rec. X.227 | ISO/IEC 8650-1
ATOMIC-ACTION-IDENTIFIER ::= SEQUENCE
{
owners-name CHOICE {
name [0] EXPLICIT AE-title,
side [1] ENUMERATED
{ sender(0), receiver(1), ... },
... },
atomic-action-suffix CHOICE {
form1 [2] OCTET STRING,
form2 [3] INTEGER,
... }
}
side is shorthand and basically means "use the AE-Title belonging to the specified end of the connection, as we already exchanged"
AE-Title is imported from X.227
ACSE-1 { joint-iso-itu-t association-control(2) modules(0) apdus(0) version1(1) }
-- ACSE-1 refers to ACSE version 1
DEFINITIONS ::=
BEGIN
v
-- The data types Name and RelativeDistinguishedName are imported from ISO/IEC9594-2.
-- object identifier assignments.
IMPORTS Name, RelativeDistinguishedName
FROM InformationFramework { joint-iso-ccitt ds(5) modules(1) informationFramework(1) } ;
-- As defined in CCITT Rec. X.650 | ISO 7498-3, an application-entity title is composed of an
-- application-process title and an application-entity qualifier. The ACSE protocol provides for the transfer of
-- an application-entity title value by the transfer of its component values. However, the following data type is
-- provided for International Standards that reference a single syntactic structure for AE titles.
AE-title ::= CHOICE { AE-title-form1, AE-title-form2 }
AE-title-form1 ::= Name
-- For access to The Directory (ITU-T Rec. X.500-Series | ISO/IEC 9594), an AE title
-- has AE-title-form1. This value can be constructed from AP-title-form1 and AE-qualifier-form1 values
-- contained in an AARQ or AARE APDU. A discussion of forming an AE-title-form1 from AP-title-form1 and
-- AE-qualifier-form1 may be found in CCITT Rec. X.665 | ISO/IEC 9834-6.
AE-title-form2 ::= OBJECT IDENTIFIER
Continuing the standards chase, Name comes from X.501, and is the same definition as used for x.509 certificates (i.e. the DC=com, DC=example, OU=users, CN=bob type structure)
The full definition can be found in either X.501 or the IETF PKIX RFCs. The latest version of X.501 is only available after payment due to ISO nonsense, but older versions including the 2016 revision are free.
The XAP-TP page 52 effectively confirms that the XA XID is the BER encoding of ATOMIC-ACTION-IDENTIFIER, after expanding any side shorthand. (I presume this should actually be the DER encoding, so they're byte comparable)

Related

Is there a syslog private enterprise number for custom/internal use?

So I recently was looking for a way to add extra metadata to logs and found out that syslog got me covered. I can add custom metadata using SD-ID feature like this:
[meta#1234 project="project-name" version="1.0.0-RC5" environment="staging" user="somebody#example.com"]
The problem is that 1234 has to be a syslog private enterprise number.
I assume those are given to big companies like microsoft or apple, but not to indie developers.
So My question is, is there a reserved number for internal use that everyone could use without registration for internal purpose?
If you use RFC5424-formatted messages, you can (or could) create custom fields in the SDATA (Structured Data) part of the message.
The latter part of a custom field in the SDATA is, as you mentioned, the private enterprise number (or enterpiseId).
As per RFC5424 defined:
7.2.2. enterpriseId
The "enterpriseId" parameter MUST be a 'SMI Network Management Private Enterprise Code', maintained by IANA, whose prefix is iso.org.dod.internet.private.enterprise (1.3.6.1.4.1). The number that follows MUST be unique and MUST be registered with IANA as per RFC 2578 [RFC2578].
Of course it depends on what you're using it for, if it's only for local logs, you can use any enterpriseId or you can even use a predefined SDATA field with a reserved SD-ID and rewrite it's value. (See: syslog-ng Guide)

not able to whielist a class in corda 4?

Hi I used this example https://docs.corda.net/serialization.html#whitelisting to whitelist a java.sql.timestamp class manually but still I get this error:
"No unique deserialisation constructor found for class class java.sql.Timestamp, type is marked as non-composable
E 10:05:59 80 SerializationOutput.log - Serialization failed direction="Serialize", type="java.sql.Timestamp", msg="Class "class java.sql.Timestamp" is not on the whitelist or annotated with #CordaSerializable.", ClassChain="java.util.List<*> -> java.sql.Timestamp"
E 10:05:59 80 RestController.createIOU - Class "class java.sql.Timestamp" is not on the whitelist or annotated with #CordaSerializable"
here is my whitelist code:
class TradingAppSerializationWhitelist : SerializationWhitelist {
// Add classes like this.
override val whitelist = listOf(Timestamp::class.java)
}
For such a type, you would need to write a custom serialiser, not just whitelist the type.
However, may I ask why you want to use that type specifically? It’s more conventional to use java.time.Instant to record times on ledger when you need a time to machine precision, or the other types like java.time.LocalDateTime to record a time to human levels of precision (e.g. “8pm Tuesday” when no time zone is specified)
If you have data that’s starting from java.sql.Timestamp it’d be better to convert to an Instant, as that type has a much better design.
Additionally, timestamps are included within transactions by default. See the answer to this question to see how In Corda, how to get the timestamp of when a transaction happened?

DICOM : Is this a valid Associate Response?

My application is Storage SCU. It pushes NM and CT instances to third party PACS. I am proposing four presentation context in my association (Associate Request). PACS is responding (Associate Response) like below:
Application Context: DICOM Application Context Name
Implementation Class: 1.2........
Implementation Version: XYZ
Maximum PDU Size: 32768
Called AE Title: PACS
Calling AE Title: MyApp
Presentation Contexts: 4
Presentation Context: 1 [Accept]
Abstract: Nuclear Medicine Image Storage
Transfer: Explicit VR Little Endian
Presentation Context: 3 [Reject - Transfer Syntaxes Not Supported]
Abstract: Nuclear Medicine Image Storage
Transfer: JPEG 2000 Lossy
Presentation Context: 5 [Proposed]
Abstract: CT Image Storage
Transfer: Explicit VR Little Endian
Presentation Context: 7 [Reject - Transfer Syntaxes Not Supported]
Abstract: CT Image Storage
Transfer: JPEG 2000 Lossy
Second and fourth (id 3 and 7) presentation context is rejected as expected. PACS DICOM Conformance statement states that it does not support that transfer syntax.
First (id 1) presentation context is accepted as expected.
Look at third (id 5) presentation context. It's status says [Proposed].
In my understanding, PACS should either accept the presentation context or reject it. It must not keep the status [Proposed] as is which was set by SCU i.e. my application.
Is my understanding correct?
I am looking in to specifications to find something concluding; no success so far. Please point me to the location in specifications where this is explained.
Edit 1:
PS 3.7-2011 - Message Exchange
D.3.2 Presentation contexts negotiation
c. the Association-acceptor may accept or reject each Presentation
Context individually.
Look at the may in specifications. What does this mean? Is it up to the SCP to "accept or reject (or leave as is i.e. [proposed])" the status?
"Proposed" means that the SCP didn't include in the reply the abstract syntax with the proper code:
0 acceptance​
1 user-rejection​
2 no-reason (provider rejection)​
3 abstract-syntax-not-supported (provider rejection)​
4 transfer-syntaxes-not-supported (provider rejection)​
Therefore DCMTK leaves in the abstract syntax the original status of "Not yet negotiated" (printed as "proposed" in the logs).
In DCMTK this status is represented by the constant ASC_P_NOTYETNEGOTIATED.
It looks like the SCP is to blame here

What is the value of ul (User Language) in Google Analytics Measurement protocol

I am building a server side application that needs to report data to GA via Measurement Protocol.
I want to fill the languages that the user have, from the documentation:
https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#ul
It seems the right parameter is called ul and an example value is en-us.
My questions are:
which kind of langague identifier it accepts? the documentation isn't clear on that. My guess is that following the "en-us" example suggests it is based on Accept-Language header so probably ISO-639-1 +ISO-3166)
It only has space for 20 bytes, so does it means you can't send multiple langagues?
Does the reporting show multiple languages?
If you goto Google Analytics Dashboard -> Audience -> Geo -> Language and hover over the help icon next to language column you get this popup -
It apparently uses ISO 639 language codes.
Only one language can be sent per hit. It is not a multi value property.
(2) above makes it obvious what reports can show
In the documentation (as of aug '18), the following is shown:
Optional. Specifies the language.
Parameter Value | Type | Default Value | Max Length | Supported Hit Types
ul text None 20 Bytes all
Example value: en-us
Example usage: ul=en-us

F# unordered collection type to represent resources and costs

To practise a little F#, I'm building myself a simple game. The game involves resources that players can spend. There are 3 kinds of resources. Items and actions in the game have an associated cost that can combine amounts of any number of these resources (or none, for free actions). I started implementing this much along the lines of : Creating a list with multiple units of measurements of floats in F#
[<Measure>] type gold
[<Measure>] type wood
[<Measure>] type stone
type Resource =
| Gold of int<gold>
| Wood of int<wood>
| Stone of int<stone>
Now I need a collection data type to represent a cost. I want it to :
Contain Resources. Ideally it would be constrained to no more than 1 Resource of each type, but that safety I could do without.
Be unordered. (1<gold>, 2<wood>) needs to equal (2<wood>, 1<gold>) ideally without redefining equality for the type.
Be easily summable with another collection of the same type (actions may have optional costs which will add up to the normal cost) and subtractable (from a player's pool of resources).
What would be a good F# collection type to do that ? I realized not many are unordered. I was looking at Set<'T> but the "based on binary trees" part has me a little confused and I'm not sure it suits my needs.
What do you think ? Did I miss something obvious in my design ?
If you need to represent resources containing some amount of gold, wood and stone, then it might make more sense to use a record type rather than a collection (e.g. a map or list) of discriminated unions.
For example, if you define your record like this:
type Resources =
{ Gold : int<gold>
Wood : int<wood>
Stone : int<stone> }
Then a value of Resources satisfies all your criteria - it contains at most one filed for each kind of resource (it contains exactly one field of each kind, but the value can be zero). The fields are ordered, but the order does not matter (when creating the value) and you can also easily define + operator on the type:
type Resources =
{ Gold : int<gold>
Wood : int<wood>
Stone : int<stone> }
static member (+) (r1:Resources, r2:Resources) =
{ Gold = r1.Gold + r2.Gold
Wood = r1.Wood + r2.Wood
Stone = r1.Stone + r2.Stone }
static member Zero =
{ Gold = 0<gold>; Stone = 0<stone>; Wood = 0<wood> }
I also added Zero member, which makes it easier to create the record if you only want to set one of the resources. For example:
let r1 = { Resources.Zero with Gold = 2<gold> }
let r2 = { Resources.Zero with Wood = 4<wood> }
r1 + r2

Resources