sbrcsr 3.2.0
ATOMAS sbrcsr

The StandardBusinessDocumentMessage (document message or SBDM), represents a collection of business documents and header information, in a Request Message or a Response Message. More...

Typedefs

typedef struct _sbr_Sbdm sbr_Sbdm
 The CSR SBDM object. More...
 

Functions

SBR_CSR_EXPORT const char * sbr_sbdm_iid (sbr_Sbdm *sbdm)
 Return the unique id for the SBDM - this is a memory only value. More...
 
SBR_CSR_EXPORT sbr_eMsgSourceType sbr_sbdm_msgsourcetype (sbr_Sbdm *sbdm)
 Indicates whether the sbdm is part of a request or response message. More...
 
SBR_CSR_EXPORT int sbr_sbdm_setmessagetype (ato_Ctx *ctx, sbr_Sbdm *sbdm, const char *messagetype)
 Set the message type for this sbdm and request (request only). More...
 
SBR_CSR_EXPORT const char * sbr_sbdm_messagetype (sbr_Sbdm *sbdm)
 Get the message type for this sbdm. More...
 
SBR_CSR_EXPORT int sbr_sbdm_setparty (ato_Ctx *ctx, sbr_Sbdm *sbdm, sbr_eMsgPartyType partytype, const char *iddesignation, const char *idname)
 Set the other party details for this sbdm and request (request only). More...
 
SBR_CSR_EXPORT sbr_MsgPartysbr_sbdm_party (sbr_Sbdm *sbdm, sbr_eMsgPartyType partytype)
 Get the other party details for this sbdm. More...
 
SBR_CSR_EXPORT int sbr_sbdm_doc_add (ato_Ctx *ctx, sbr_Sbdm *sbdm, sbr_Doc **doc, const char *validationuri, const char *governmentid, const char *businessid, time_t createtime)
 Create and add a new document object - use sbr_doc_setcontent() to add content (request only). More...
 
SBR_CSR_EXPORT int sbr_sbdm_doc_remove (ato_Ctx *ctx, sbr_Sbdm *sbdm, sbr_Doc *doc)
 Remove the indicated document from the sbdm (request only) - not currently implemented. More...
 
SBR_CSR_EXPORT size_t sbr_sbdm_doc_count (sbr_Sbdm *sbdm)
 Get the number of documents in this sbdm. More...
 
SBR_CSR_EXPORT void sbr_sbdm_doc_iterator (sbr_Sbdm *sbdm, ato_Iterator **iter)
 Create an iterator for the collection of a documents - caller must free. More...
 
SBR_CSR_EXPORT sbr_Docsbr_sbdm_doc_firstv (sbr_Sbdm *sbdm)
 Get the first document of the collection. More...
 
SBR_CSR_EXPORT sbr_Docsbr_sbdm_doc_nextv (sbr_Sbdm *sbdm)
 Get the next document of the collection. More...
 
SBR_CSR_EXPORT sbr_MsgReceiptsbr_sbdm_receipt (sbr_Sbdm *sbdm)
 Get the receipt object for the sbdm (response only). More...
 
SBR_CSR_EXPORT const char * sbr_sbdm_maxseveritycode (sbr_Sbdm *sbdm)
 Get the maxseveritycode for the sbdm (response only). More...
 
SBR_CSR_EXPORT size_t sbr_sbdm_eventitem_count (sbr_Sbdm *sbdm)
 Get the number of event items (response only). More...
 
SBR_CSR_EXPORT void sbr_sbdm_eventitem_iterator (sbr_Sbdm *sbdm, ato_Iterator **iter)
 Create an iterator for the collection of event items to use in an iterator (response only) - caller must free. More...
 
SBR_CSR_EXPORT sbr_MsgEventItemsbr_sbdm_eventitem_firstv (sbr_Sbdm *sbdm)
 Get the first event item of the collection (response only). More...
 
SBR_CSR_EXPORT sbr_MsgEventItemsbr_sbdm_eventitem_nextv (sbr_Sbdm *sbdm)
 Get the next event item of the collection (response only). More...
 
SBR_CSR_EXPORT size_t sbr_sbdm_timestamp_count (sbr_Sbdm *sbdm)
 Get the number of timestamps. More...
 
SBR_CSR_EXPORT void sbr_sbdm_timestamp_iterator (sbr_Sbdm *sbdm, ato_Iterator **iter)
 Create an iterator for the collection of timestamps - caller must free. More...
 
SBR_CSR_EXPORT sbr_MsgTimestampsbr_sbdm_timestamp_firstv (sbr_Sbdm *sbdm)
 Get the first timestamp of the collection. More...
 
SBR_CSR_EXPORT sbr_MsgTimestampsbr_sbdm_timestamp_nextv (sbr_Sbdm *sbdm)
 Get the next timestamp of the collection. More...
 

Detailed Description

The StandardBusinessDocumentMessage (document message or SBDM), represents a collection of business documents and header information, in a Request Message or a Response Message.

While similar, the content differs depending on whether the message is a request or response (sbr_eMsgSourceType).

This is documented in the individual methods.

Typedef Documentation

◆ sbr_Sbdm

typedef struct _sbr_Sbdm sbr_Sbdm

The CSR SBDM object.

Used when adding business documents to a request for submission to CSR - see sbr_Request. Used when extracting business documents from a response - see sbr_Response.

Function Documentation

◆ sbr_sbdm_iid()

SBR_CSR_EXPORT const char * sbr_sbdm_iid ( sbr_Sbdm sbdm)

Return the unique id for the SBDM - this is a memory only value.

Parameters
sbdmthe StandardBusinessDocumentMessage object
Returns
unique id.

◆ sbr_sbdm_msgsourcetype()

SBR_CSR_EXPORT sbr_eMsgSourceType sbr_sbdm_msgsourcetype ( sbr_Sbdm sbdm)

Indicates whether the sbdm is part of a request or response message.

Parameters
sbdmthe StandardBusinessDocumentMessage object
Returns
the sourcetype of the object (request/response).

◆ sbr_sbdm_setmessagetype()

SBR_CSR_EXPORT int sbr_sbdm_setmessagetype ( ato_Ctx ctx,
sbr_Sbdm sbdm,
const char *  messagetype 
)

Set the message type for this sbdm and request (request only).

This will override the value in the template (StandardBusinessDocumentHeader:Message.Type.Text).

If this is a response sbdm then this will call will be ignored and will silently fail.

Parameters
ctxthe current thread local Context.
sbdmthe request object.
messagetypethe messagetype string (e.g. "message.ping").
Returns
ATO_ERR_OK if successful or an errorcode OR -1 if the call is ignored (SBR_RESPONSE sbdm).

◆ sbr_sbdm_messagetype()

SBR_CSR_EXPORT const char * sbr_sbdm_messagetype ( sbr_Sbdm sbdm)

Get the message type for this sbdm.

This will override any value in the template (StandardBusinessDocumentHeader:Message.Type.Text).

If this is a response sbdm then this will return NULL.

Parameters
sbdmthe StandardBusinessDocumentMessage object.
Returns
the messagetype string (e.g. "message.ping") or NULL.

◆ sbr_sbdm_setparty()

SBR_CSR_EXPORT int sbr_sbdm_setparty ( ato_Ctx ctx,
sbr_Sbdm sbdm,
sbr_eMsgPartyType  partytype,
const char *  iddesignation,
const char *  idname 
)

Set the other party details for this sbdm and request (request only).

This will override any value in the template

  • StandardBusinessDocumentHeader:Receiver:IdentificationDetails.IdentifierDesignation.Text (agencyid).
  • StandardBusinessDocumentHeader:Receiver:IdentificationDetails.IdentifierName.Text (name).

If this is a response sbdm then this call will be ignored and will silently fail.

Parameters
ctxthe current thread local Context.
sbdmthe StandardBusinessDocumentMessage object.
partytypeSBR_MSG_RECEIVER or SBR_MSG_SENDER - see sbr_eMsgPartyType
iddesignationthe identifier designation string (e.g. "ato.gov.au").
idnamethe party identifier name - for agencies use SBR_PARTYSCHEME_AGENCY (preset to 'AgencyInternetDomainName').
Returns
ATO_ERR_OK if successful or an errorcode OR -1 if the call is ignored (SBR_RESPONSE sbdm).

◆ sbr_sbdm_party()

SBR_CSR_EXPORT sbr_MsgParty * sbr_sbdm_party ( sbr_Sbdm sbdm,
sbr_eMsgPartyType  partytype 
)

Get the other party details for this sbdm.

Use sbr_msgp_type() to determine if sender or receiver. Note that in a request the type will always be SBR_MSG_RECEIVER; and for a response it will always be SBR_MSG_SENDER.

Parameters
sbdmthe StandardBusinessDocumentMessage object.
partytypeSBR_MSG_RECEIVER or SBR_MSG_SENDER - see sbr_eMsgPartyType
Returns
an sbr_MsgParty object.

◆ sbr_sbdm_doc_add()

SBR_CSR_EXPORT int sbr_sbdm_doc_add ( ato_Ctx ctx,
sbr_Sbdm sbdm,
sbr_Doc **  doc,
const char *  validationuri,
const char *  governmentid,
const char *  businessid,
time_t  createtime 
)

Create and add a new document object - use sbr_doc_setcontent() to add content (request only).

This will return an error if called on a response.

This object will be free when the request is freed. Alternatively, it will be freed if sbr_sbdm_doc_remove() is called on the returned document object.

An appropriate sequence number is assigned.

Parameters
ctxthe current thread local Context.
sbdmthe StandardBusinessDocumentMessage object.
docthe address of the document object to create. Do not explictly free.
validationurithe validation uri
governmentidthe government identifier
businessida business specific identifier
createtimethe time to assign as the create datetime.
Returns
ATO_ERR_OK if successful or an errorcode OR -1 if the call is ignored (SBR_RESPONSE sbdm).

◆ sbr_sbdm_doc_remove()

SBR_CSR_EXPORT int sbr_sbdm_doc_remove ( ato_Ctx ctx,
sbr_Sbdm sbdm,
sbr_Doc doc 
)

Remove the indicated document from the sbdm (request only) - not currently implemented.

This will return an error if called on a response.

The document object will be freed, so do not reference it after this call.

Parameters
ctxthe current thread local Context.
sbdmthe StandardBusinessDocumentMessage object.
docthe document object to free.
Returns
ATO_ERR_OK if successful or an errorcode OR -1 if the call is ignored (if its a SBR_RESPONSE sbdm).

◆ sbr_sbdm_doc_count()

SBR_CSR_EXPORT size_t sbr_sbdm_doc_count ( sbr_Sbdm sbdm)

Get the number of documents in this sbdm.

Parameters
sbdmthe StandardBusinessDocumentMessage object.
Returns
document count.

◆ sbr_sbdm_doc_iterator()

SBR_CSR_EXPORT void sbr_sbdm_doc_iterator ( sbr_Sbdm sbdm,
ato_Iterator **  iter 
)

Create an iterator for the collection of a documents - caller must free.

This is useful if a collection is being shared between threads and each thread has its own iterator.

If this is not the case then the sbr_sbdm_doc_firstv() and sbr_sbdm_doc_nextv() methods are simpler and this method can be ignored.

Parameters
sbdmthe StandardBusinessDocumentMessage object.
iterthe address of the iterator to create - *iter must be NULL. This will be NULL if there is no collection.

◆ sbr_sbdm_doc_firstv()

SBR_CSR_EXPORT sbr_Doc * sbr_sbdm_doc_firstv ( sbr_Sbdm sbdm)

Get the first document of the collection.

This also initialises the iterator associated with the current sbdm eventitems.

Parameters
sbdmthe StandardBusinessDocumentMessage object.
Returns
a document or NULL if none.

◆ sbr_sbdm_doc_nextv()

SBR_CSR_EXPORT sbr_Doc * sbr_sbdm_doc_nextv ( sbr_Sbdm sbdm)

Get the next document of the collection.

Parameters
sbdmthe StandardBusinessDocumentMessage object.
Returns
a document or NULL if none.

◆ sbr_sbdm_receipt()

SBR_CSR_EXPORT sbr_MsgReceipt * sbr_sbdm_receipt ( sbr_Sbdm sbdm)

Get the receipt object for the sbdm (response only).

This will return NULL if called on a request sbdm.

Parameters
sbdmthe StandardBusinessDocumentMessage object.
Returns
a receipt object or NULL.

◆ sbr_sbdm_maxseveritycode()

SBR_CSR_EXPORT const char * sbr_sbdm_maxseveritycode ( sbr_Sbdm sbdm)

Get the maxseveritycode for the sbdm (response only).

This will return NULL if called on a request sbdm.

This will be set to 'Information' in the case of no errors.

Parameters
sbdmthe StandardBusinessDocumentMessage object.
Returns
the max severity code value or NULL.

◆ sbr_sbdm_eventitem_count()

SBR_CSR_EXPORT size_t sbr_sbdm_eventitem_count ( sbr_Sbdm sbdm)

Get the number of event items (response only).

This will return 0 if called on a request sbdm.

There will be at least one, even when there are no errors.

Parameters
sbdmthe StandardBusinessDocumentMessage object.
Returns
item count or 0.

◆ sbr_sbdm_eventitem_iterator()

SBR_CSR_EXPORT void sbr_sbdm_eventitem_iterator ( sbr_Sbdm sbdm,
ato_Iterator **  iter 
)

Create an iterator for the collection of event items to use in an iterator (response only) - caller must free.

This is useful if a collection is being shared between threads and each thread has its own iterator.

If this is not the case then the sbr_sbdm_eventitem_firstv() and sbr_sbdm_eventitem_nextv() methods are simpler and this method can be ignored.

This will return NULL if called on a request sbdm.

Parameters
sbdmthe StandardBusinessDocumentMessage object.
iterthe address of the iterator to create - *iter must be NULL. This will be NULL if there is no collection.

◆ sbr_sbdm_eventitem_firstv()

SBR_CSR_EXPORT sbr_MsgEventItem * sbr_sbdm_eventitem_firstv ( sbr_Sbdm sbdm)

Get the first event item of the collection (response only).

This also initialises the iterator associated with the current sbdm eventitems.

This will return NULL if called on a request sbdm.

Parameters
sbdmthe StandardBusinessDocumentMessage object.
Returns
an eventitem or NULL if none or this is a request.

◆ sbr_sbdm_eventitem_nextv()

SBR_CSR_EXPORT sbr_MsgEventItem * sbr_sbdm_eventitem_nextv ( sbr_Sbdm sbdm)

Get the next event item of the collection (response only).

This will return NULL if called on a request sbdm.

Parameters
sbdmthe StandardBusinessDocumentMessage object.
Returns
an eventitem or NULL if none or this is a request.

◆ sbr_sbdm_timestamp_count()

SBR_CSR_EXPORT size_t sbr_sbdm_timestamp_count ( sbr_Sbdm sbdm)

Get the number of timestamps.

Parameters
sbdmthe StandardBusinessDocumentMessage object.
Returns
count or 0.

◆ sbr_sbdm_timestamp_iterator()

SBR_CSR_EXPORT void sbr_sbdm_timestamp_iterator ( sbr_Sbdm sbdm,
ato_Iterator **  iter 
)

Create an iterator for the collection of timestamps - caller must free.

This is useful if a collection is being shared between threads and each thread has its own iterator.

If this is not the case then the sbr_sbdm_timestamp_firstv() and sbr_sbdm_timestamp_nextv() methods are simpler and this method can be ignored.

Parameters
sbdmthe StandardBusinessDocumentMessage object.
iterthe address of the iterator to create - *iter must be NULL. This will be NULL if there is no collection.

◆ sbr_sbdm_timestamp_firstv()

SBR_CSR_EXPORT sbr_MsgTimestamp * sbr_sbdm_timestamp_firstv ( sbr_Sbdm sbdm)

Get the first timestamp of the collection.

This also initialises the iterator associated with the current sbdm timestamps.

Parameters
sbdmthe StandardBusinessDocumentMessage object.
Returns
an eventitem NULL if none.

◆ sbr_sbdm_timestamp_nextv()

SBR_CSR_EXPORT sbr_MsgTimestamp * sbr_sbdm_timestamp_nextv ( sbr_Sbdm sbdm)

Get the next timestamp of the collection.

Parameters
sbdmthe StandardBusinessDocumentMessage object.
Returns
a timestamp or NULL if none.