SOME/IP Server Stack

Overview

RAPIDSEA supports SOME/IP protocol as explained in the SOME/IP Protocol page. This page explains the server architecture and details how the user should interface the stack with their custom logic and realize the ECU implementation quickly. It also provides guidelines on adopting the stack for different systems.

The below diagram captures the block level diagram of the SOME/IP server and how it interfaces with other modules.

SOME/IP Stack Block Diagram

Application Interface

While the RAPIDSEA SOME/IP server stack can handle most of the functionality such as message validation, service discovery management, subscription handling, Notification process etc, the business logic has to implement the application functionality. the RAPIDSEA SOME/IP server clearly defines API and callback functions that are essential for the user to use/implement.

The below table captures the function that are to be called from the application logic.

API Functions

Function

Description

rs_some_server_open

To initialize the SOME/IP server instance structure for both discovery and notification process.

rs_some_server_run

To be called to set the run state for state machine for both discovery and notification process.

rs_some_server_set_tx_msg_buf

To set up the transmit buffers to be used for the SOME/IP server communication.

rs_some_server_set_rx_msg_buf

To set up the receive buffers to be used for the SOME/IP server communication.

rs_some_server_req_stop_offer_service

To frame and sent the stop offer service from server

rs_some_server_process

To be called to call the discovery and notification’s state machine and process respectively and notification event send function.

rs_some_server_subscribe_init

To initialize the SOME/IP subscription details structure associated with the server

rs_some_server_close

To freed the SOME/IP server handle

There are many functions through which the SOME/IP server stack retrieves information from the application logic or indicate actions to be performed. These functions are captured in the below table.

Callback Functions

Function

Description

rcb_some_server_receive_req_handler

Called to handle (get/set) the request received from client for the given method and event ID

rcb_some_server_get_all_instance_id_for_srv_id

Called to get Instance ID for service ID.

rcb_some_server_get_available_srv_and_insta_id

Called to get all service ID and Instance ID from predefined structure.

rcb_some_server_get_instance_evengrp_id

Called to get service ID,Instance ID,eventgroup ID for given event ID.

rcb_some_server_is_sub_service_avail

called to check service available or not and registered if available.

rcb_some_server_reset_service_registered

Called to reset the registration for give details.

rcb_some_server_is_service_avail

Called to check service available or not.

rcb_some_server_is_instance_avail

Called to check service and instance available or not.

rcb_some_server_get_event_info

Called to get event information for given event ID.

These functions are documented in detail in the below sections. It is important for the server to implement these functions correct for proper operation of the system.

Implementation Guide

This section explains how the SOME/IP server can be implemented using the RAPIDSEA stack. Whether the stack is available in source form or in binary form, the steps to be followed are

  • Implement the Callback functions mentioned above

  • Initialize the buffers necessary for the operation

  • Initialize the SOME/IP stack function.

  • Periodically call the discovery and notification process functions so that internal timeouts are handled.

High level flow chart is depicted below:

SOME/IP Server Flow Diagram

The below diagram captures the high level sequence of operations associated with the SOME/IP stack.

SOME/IP High level Sequence Diagram

This can be implemented in a bare-metal system or over RTOS or over full fledged OS such as Linux etc.

Dependency

This stack depends on the below RAPIDSEA interfaces that can be obtained or custom implemented.

Example demo

An example implementation is available along with the release and is described in SOME/IP Server Demo.

SOME/IP Server Header Details

Documentation from the relevant header as follows:

SOME/IP server based APIs.

This file have declaration of SOME/IP server based functions

Author

Embien RAPIDSEA Team

Copyright

Embien Technologies India Pvt. Ltd.

Typedefs

typedef struct tag_rs_someip_server_config rs_someip_server_config_t

Contains information about SOME/IP server configuration.

typedef struct tag_rs_someip_server_instance rs_someip_server_instance_t

Contains information about SOME/IP server instance.

Functions

rs_handle_t rs_some_server_open(rs_someip_server_instance_t *ptr_instance, rs_someip_server_config_t *ptr_config)

Initialize the SOME/IP instance structure with initial values.

This function initialize the SOME/IP instance structure with initial values.

Parameters:
  • ptr_instance[in] - Pointer to the SOME/IP server instance

  • ptr_config[in] - Pointer to the SOME/IP server configuration

Returns:

Handle of the SOME/IP instance information

rs_ret_val_t rs_some_server_run(rs_handle_t handle, uint32_t u32_run)

Assign the initial state of the state machine for both discovery and notification.

This function assigns the initial state of the state machine for both discovery and notification.

Parameters:
  • handle[in] - Handle of the SOME/IP server instance.

  • u32_run[in] - State will be set according to this value.

Returns:

Zero on success or negative error code on failure.

rs_ret_val_t rs_some_server_set_tx_msg_buf(rs_handle_t handle, rs_someip_msg_t *ptr_tx_msgs, uint32_t u32_num_msg, void *ptr_msg_ptr_buf, uint8_t u8_proc_type)

Set up the transmit buffers to be used for the SOME/IP server stack.

This function sets up the transmit buffers to be used for SOME/IP server stack

Parameters:
  • handle[in] - Handle of SOME/IP server instance

  • ptr_tx_msgs[in] - Pointer to the array of SOME/IP transmit messages

  • u32_num_msg[in] - Number of transmit messages that the SOME/IP stack can use from the above array

  • ptr_msg_ptr_buf[in] - Pointer to the message pointer buffer

  • u8_proc_type[in] - Process type (Discovery or Notification)

Returns:

Zero on success or negative error code on failure.

rs_ret_val_t rs_some_server_set_rx_msg_buf(rs_handle_t handle, rs_someip_msg_t *ptr_rx_msgs, uint32_t u32_num_msg, void *ptr_msg_ptr_buf, uint8_t u8_proc_type)

Set up the receive buffers to be used for the SOME/IP stack.

This function sets up the receive buffers to be used for SOME/IP stack

Parameters:
  • handle[in] - Handle of SOME/IP server instance

  • ptr_rx_msgs[in] - Pointer to the array of SOME/IP receive messages

  • u32_num_msg[in] - Number of receive messages that the SOME/IP stack can use from the above array

  • ptr_msg_ptr_buf[in] - Pointer to the message pointer buffer

  • u8_proc_type[in] - Process type (Discovery or Notification)

Returns:

Zero on success or negative error code on failure.

rs_ret_val_t rs_some_server_req_stop_offer_service(rs_handle_t handle, uint8_t u8_proc_type)

Frame and send stop offer service.

This function frame and send the stop offer service.

Parameters:
  • handle[in] - Handle of the SOME/IP server instance

  • u8_proc_type[in] - Process type whether discovery or notification.

Returns:

return 0 if success negative value if failure.

rs_ret_val_t rs_some_server_subscribe_init(rs_handle_t handle, rs_someip_subscribe_info_t *ptr_subscribe_info, uint32_t u32_num_subscription)

Initialize the subscription structure.

This function initialize the subscription structure in given instance structure to store subscribe information.

Parameters:
  • handle[in] - Handle of the SOME/IP server instance.

  • ptr_subscribe_info[in] - Pointer to subscription structure.

  • u32_num_subscription[in] - Max number of subscription.

Returns:

Return 0 if success or negative if failure.

rs_ret_val_t rcb_some_server_receive_req_handler(rs_handle_t handle, uint16_t u16_srv_id, uint16_t u16_insta_id, uint16_t u16_eventgrp_id, uint16_t u16_method_id, uint16_t u16_event_id, rs_someip_data_t *payload, uint8_t u8_proc_type)

Get and load requested data.

This function get and load requested data in payload structure for corresponding request.

Parameters:
  • handle[in] - Handle of the SOME/IP server instance.

  • u16_srv_id[in] - Service ID

  • u16_insta_id[in] - Instance ID of request

  • u16_eventgrp_id[in] - Eventgroup ID of request

  • u16_method_id[in] - Method ID of request

  • u16_event_id[in] - Event ID of request

  • payload[out] - Pointer to the payload structure

  • u8_proc_type[in] - Process type whether discovery or notification.

Returns:

Return error code.

rs_ret_val_t rcb_some_server_get_all_instance_id_for_srv_id(rs_handle_t handle, uint16_t u16_service_id, uint16_t *ptr_instance_id)

Called to get Instance ID for service ID.

This function called to get Instance ID for service ID.

Parameters:
  • handle[in] - Handle of the SOME/IP server instance

  • u16_service_id[in] - Service ID.

  • ptr_instance_id[out] - Pointer to the instance ID array.

Returns:

Return Number of element in instance ID array.

rs_ret_val_t rcb_some_server_get_available_srv_and_insta_id(rs_handle_t handle, uint16_t *ptr_srv_id, uint16_t *ptr_insta_id)

Called to get all service ID and Instance ID from predefined structure.

This function called to get all service ID and Instance ID from predefined structure.

Parameters:
  • handle[in] - Handle of the SOME/IP instance information

  • ptr_srv_id[out] - Pointer to the service ID array.

  • ptr_insta_id[out] - Pointer to the instance ID array.

Returns:

Return Number of element in array.

rs_ret_val_t rcb_some_server_get_instance_evengrp_id(rs_handle_t handle, uint16_t u16_event_id, uint16_t *ptr_srv_id, uint16_t *ptr_insta_id, uint16_t *ptr_eventgrp_id)

Called to get service ID,Instance ID, eventgroup ID for given event ID.

This function called to get service ID,Instance ID,eventgroup ID for given event ID..

Parameters:
  • handle[in] - Handle of the SOME/IP instance information

  • u16_event_id[in] - Event ID.

  • ptr_srv_id[out] - Pointer to the service ID array.

  • ptr_insta_id[out] - Pointer to the instance ID array.

  • ptr_eventgrp_id[out] - Pointer to the eventgroup ID array.

Returns:

Return 0 if success or negative value if failure.

rs_ret_val_t rcb_some_server_is_sub_service_avail(rs_handle_t handle, rs_someip_subscribe_info_t *ptr_data, uint8_t u8_maj_ver)

Called to check service available or not.

This function called to check service available or not and registered if available.

Parameters:
  • handle[in] - Handle of the SOME/IP instance information

  • ptr_data[in] - Pointer to the subscribe structure.

  • u8_maj_ver[out] - Major version.

Returns:

Return 1 if success or 0 if failure.

rs_ret_val_t rcb_some_server_reset_service_registered(rs_handle_t handle, uint16_t u16_service_id, uint16_t u16_instance_id, uint16_t u16_eventgrp_id)

Called to reset the registration for give details.

This function called to reset the registration for give details.

Parameters:
  • handle[in] - Handle of the SOME/IP instance information

  • u16_service_id[in] - Service ID.

  • u16_instance_id[out] - Instance ID.

  • u16_eventgrp_id[in] - Eventgroup ID.

Returns:

Return 0 on success.

rs_ret_val_t rcb_some_server_is_service_avail(rs_handle_t handle, uint16_t u16_ser_id)

Called to check service available or not.

This function called to check service available or not.

Parameters:
  • handle[in] - Handle of the SOME/IP instance information

  • u16_ser_id[in] - Service ID.

Returns:

Return 1 if success or 0 if failure.

rs_ret_val_t rcb_some_server_is_instance_avail(rs_handle_t handle, uint16_t u16_service_id, uint16_t u16_instance_id)

Called to check service and instance available or not.

This function called to check service and instance available or not.

Parameters:
  • handle[in] - Handle of the SOME/IP instance information

  • u16_service_id[in] - Service ID.

  • u16_instance_id[in] - Instance ID.

Returns:

Return 1 if success or 0 if failure.

rs_ret_val_t rs_some_server_process(rs_handle_t someip_server_handle)

Called to call the discovery and notification’s state machine and process respectively and notification event send function.

This function called to call the discovery and notification’s state machine and process respectively and notification event send function.

Parameters:

someip_server_handle[in] - Handle of the SOME/IP instance information

Returns:

Return 0 if success or negative value if failure.

rs_someip_events_t *rcb_some_server_get_event_info(rs_handle_t handle, uint16_t u16_event_id)

Called to get the event ID information.

This function called to get the event ID information.

Parameters:
  • handle[in] - Handle of the SOME/IP instance information

  • u16_event_id[in] - Event ID.

Returns:

Return pointer to a SOME/IP events buffer if available or NULL

rs_ret_val_t rs_some_server_close(rs_handle_t someip_server_handle)

Called to free the SOME/IP server handle.

This function called to free the SOME/IP server handle.

Parameters:

someip_server_handle[in] - Handle of the SOME/IP instance information

Returns:

Return 0 if success or negative value if failure.

struct tag_rs_someip_server_config
#include <rs_someip_server.h>

Contains information about SOME/IP server configuration.

Public Members

uint8_t sd_addr[RS_IP_ADDR_LEN]

Initial IP Address for SOME/IP discovery process.

uint16_t sd_port

SD Port number for UDP IP.

uint8_t sn_addr[RS_IP_ADDR_LEN]

Initial IP Address for SOME/IP notification process.

uint16_t sn_srv_port

SN server’s Port number for UDP IP.

uint16_t sn_cli_port

SN client’s Port number for UDP IP.

uint8_t protocol_ver

SOME/IP protocol version.

uint8_t interface_ver

SOME/IP interface version.

uint8_t major_ver

SOME/IP major version.

uint8_t minor_ver

SOME/IP minor version.

uint8_t broadcast_addr[RS_IP_ADDR_LEN]

Broadcast IP address.

uint8_t server_addr[RS_IP_ADDR_LEN]

SOME/IP client IP address.

struct tag_rs_someip_server_instance
#include <rs_someip_server.h>

Contains information about SOME/IP server instance.

Public Members

rs_someip_server_config_t *ptr_config

Pointer to containing server configuration.

rs_someip_process_info_t notify_process_info

SOME/IP server notification process information.

rs_someip_process_info_t discov_process_info

SOME/IP server discovery process information.

rs_someip_subscribe_info_t *ptr_subscribe_details

Pointer to subscribe structure information.

uint32_t number_of_subscribe

number of subscribers

rs_someip_service_info_t *ptr_service_info

Pointer to the SOME/IP service information.

uint32_t number_of_services

Number of services.