# Diag DoIP Service

- API reference

The diag DoIP service APIs are part of the diagnostic service. The diag DoIP service provides functionality to access diag DoIP stack at runtime, including DoIP configuration and event notification. The configuration APIs can be used to set VIN, EID and GID. The event notification APIs can be used to get the client connection and disconnection event.

## IPC interfaces binding

The functions of this API are provided by the **tafDiagSvc** platform service.

The following example illustrates how to bind to the diag DoIP service.

bindings:
    {
         clientExe.clientComponent.taf_diagDoIP -> tafDiagSvc.taf_diagDoIP
    }
    Copy to clipboard

## Server-service APIs

A diag DoIP service reference can be got using taf\_diagDoIP\_GetService(). Use the returned reference for subsequent operations.

The following example illustrates how to set up a diag DoIP server-service-instance.

taf_diagDoIP_ServiceRef_t svcRef;    // Service reference
    
    // Get the service reference.
    svcRef = taf_diagDoIP_GetService(sa);
    LE_ASSERT(svcRef != NULL);
    Copy to clipboard

## DoIP stack configuration

An application can call taf\_diagDoIP\_SetVIN() / taf\_diagDoIP\_GetVIN() to set/get vehicle Identification Number, call taf\_diagDoIP\_SetEID() / taf\_diagDoIP\_GetEID() to set/get entity Identification, call taf\_diagDoIP\_SetGID() / taf\_diagDoIP\_GetGID() to set/get group Identification.

le_result_t result;
    char vin[TAF_DIAGDOIP_VIN_SIZE+1] = "xxxxxxxxxxxxxxxxx";
    char eid[TAF_DIAGDOIP_EID_SIZE+1] = "xxxxxxxxxxxx";
    char gid[TAF_DIAGDOIP_GID_SIZE+1] = "xxxxxxxxxxxx";
    
    result = taf_diagDoIP_SetVIN(vin);
    if (result != LE_OK)
    {
       LE_ERROR("Fail to set vin.");
       return result;
    }
    
    result = taf_diagDoIP_SetEID(eid);
    if (result != LE_OK)
    {
       LE_ERROR("Fail to set eid.");
       return result;
    }
    
    result = taf_diagDoIP_SetGID(gid);
    if (result != LE_OK)
    {
       LE_ERROR("Fail to set gid.");
       return result;
    }
    
    result = taf_diagDoIP_GetVIN(vin, TAF_DIAGDOIP_VIN_SIZE+1);
    if (result != LE_OK)
    {
       LE_ERROR("Fail to get vin.");
       return result;
    }
    
    result = taf_diagDoIP_SetEID(eid, TAF_DIAGDOIP_EID_SIZE+1);
    if (result != LE_OK)
    {
       LE_ERROR("Fail to get eid.");
       return result;
    }
    
    result = taf_diagDoIP_GetGID(gid, TAF_DIAGDOIP_GID_SIZE+1);
    if (result != LE_OK)
    {
       LE_ERROR("Fail to get gid.");
       return result;
    }
    Copy to clipboard

## DoIP entity event notification

After getting the service reference, an application can call taf\_diagDoIP\_AddEventHandler() to register an event handler for DoIP stack. Once a connection event occurs, the handler will be called with the event reference, event type and remote logical address.

// Rx event handler function for DoIP service.
    void EventHandler
    (
         taf_diagDoIP_ServiceRef_t svcRef,
         taf_diagDoIP_EventType_t eventType,
         uint16_t remoteLogicAddr,
         void* contextPtr
    )
    {
         // Process after succesfully event notify
    }
    
    // Register the event handler.
    taf_diagDoIP_EventHandlerRef_t eventHandlerRef =
        taf_diagDoIP_AddEventHandler(SvcRef,
             (taf_diagDoIP_EventHandlerFunc_t)EventHandler, NULL);
    LE_ASSERT(eventHandlerRef != NULL);
    
    // To remove the handler function.
    taf_diagDoIP_RemoveEventHandler(eventHandlerRef);
    Copy to clipboard

Finally call taf\_diagDoIP\_RemoveSvc() to remove the created service.

Last Published: May 11, 2026

Previous Topic
 
Diag Data ID Service Next Topic

Diag DTC Service