# Diag DoIP Service

- [API reference](https://docs.qualcomm.com/doc/80-41102-2/topic/_doxygen_rst_file__doxygen_sources_taf_diagDoIP_interface_h.html#file-taf-diagdoip-interface-h)

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()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00374_1a78c8263aa18c8eb38657e5e4fa8a7f66.html#Documentationa00374_1a78c8263aa18c8eb38657e5e4fa8a7f66). 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()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00374_1a2d6af9b4768e090088a8b13964677925.html#Documentationa00374_1a2d6af9b4768e090088a8b13964677925) / [taf\_diagDoIP\_GetVIN()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00374_1a18f395e7a05c67f58060338881be9ab8.html#Documentationa00374_1a18f395e7a05c67f58060338881be9ab8) to set/get vehicle Identification Number, call [taf\_diagDoIP\_SetEID()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00374_1a9209d3ced0abc7e55c2dec7d9da83ba9.html#Documentationa00374_1a9209d3ced0abc7e55c2dec7d9da83ba9) / [taf\_diagDoIP\_GetEID()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00374_1a74b51eb930ebf85e96eec6c14879113c.html#Documentationa00374_1a74b51eb930ebf85e96eec6c14879113c) to set/get entity Identification, call [taf\_diagDoIP\_SetGID()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00374_1a70662cc4611f421b3c2aed655bafdea1.html#Documentationa00374_1a70662cc4611f421b3c2aed655bafdea1) / [taf\_diagDoIP\_GetGID()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00374_1a1bd1f17c0d5bf604994b9ddbbd5314aa.html#Documentationa00374_1a1bd1f17c0d5bf604994b9ddbbd5314aa) 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()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00374_1a7f9e562bac0ee489442af9fc1880c077.html#Documentationa00374_1a7f9e562bac0ee489442af9fc1880c077) 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()](https://docs.qualcomm.com/doc/80-41102-2/topic/function_a00374_1a6af0d8ad3dcd2926b2017f84417b11af.html#Documentationa00374_1a6af0d8ad3dcd2926b2017f84417b11af) to remove the created service.

Last Published: Jun 09, 2026

[Previous Topic
Diag Data ID Service](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/page_c_tafDiagDataID.md) [Next Topic
Diag DTC Service](https://docs.qualcomm.com/bundle/publicresource/80-41102-2/topics/page_c_tafDiagDtc.md)