├── QRcode.png ├── __init__.py ├── bin ├── protocol │ ├── SOMEIP.py │ ├── SOMEIP_SD.py │ └── __pycache__ │ │ ├── SOMEIP.cpython-39.pyc │ │ └── SOMEIP_SD.cpython-39.pyc └── transceiver │ ├── sender.py │ └── sniffer.py ├── demo ├── snifferDemo.py ├── someipDemo.py └── someipsdDemo.py ├── docs ├── AUTOSAR_TR_SomeIpExample_4.2.1.pdf ├── SD │ ├── AUTOSAR_PRS_SOMEIPServiceDiscoveryProtocol.pdf │ └── AUTOSAR_SWS_ServiceDiscovery.pdf └── SOMEIP │ ├── AUTOSAR_PRS_SOMEIPProtocol.pdf │ ├── AUTOSAR_SWS_CommunicationManagement.pdf │ └── AUTOSAR_SWS_SOMEIPTransformer.pdf ├── nootbook ├── Allowed Option Types for Entry Types.png ├── Entry types.png ├── Flags in SOMEIP-SD.png ├── Message Validation and Error Handling in SOMEIP.png ├── Notification interaction.png ├── Overview of currently supported Entry Types.png ├── Publish Subscribe Registration Deregistration behavior(figure ignoring timings).png ├── Publish Subscribe Example for Endpoint Options and the usage of ports.png ├── Publish Subscribe State Diagram (overall behavior).png ├── Publish Subscribe State Diagram (server behavior for unicast eventgroups).png ├── Publish Subscribe State Diagram(server behavior for adaptive unicastmulticast eventgroups).png ├── Publish Subscribe State Diagram(server behavior for multicast) .png ├── Publish Subscribe with link loss at server(figure ignoring timings).png ├── Publish or Subscribe with link loss at client(figure ignoring timings).png ├── SOMEIP Header Format.png ├── SOMEIP Service State Machine Client(Update).png ├── SOMEIP Service State Machine Client.png ├── SOMEIP Service State Machine Server.png ├── SOMEIP-SD Configuration Option.png ├── SOMEIP-SD Dependencies.png ├── SOMEIP-SD Error Handling.png ├── SOMEIP-SD Eventgroup Entry Type.png ├── SOMEIP-SD Example PDU for Non-SOMEIP-SD.png ├── SOMEIP-SD Example PDU.png ├── SOMEIP-SD Header Format.png ├── SOMEIP-SD IPv4 Endpoint Option.png ├── SOMEIP-SD IPv4 Multicast Option.png ├── SOMEIP-SD IPv4 SD Endpoint Option.png ├── SOMEIP-SD IPv6 Endpoint Option.png ├── SOMEIP-SD IPv6 Multicast Option.png ├── SOMEIP-SD Load Balancing Option.png ├── SOMEIP-SD Service Entry Type.png └── SOMEIP.png └── readme.md /QRcode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/QRcode.png -------------------------------------------------------------------------------- /__init__.py: -------------------------------------------------------------------------------- 1 | from .bin.protocol.SOMEIP_SD import * 2 | from .bin.protocol.SOMEIP import SOMEIP 3 | from .bin.transceiver.sniffer import Sniffer 4 | from .bin.transceiver.sender import Sender 5 | from scapy.all import * 6 | from scapy.layers.inet import IP, UDP 7 | from scapy.layers.l2 import Ether 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /bin/protocol/SOMEIP.py: -------------------------------------------------------------------------------- 1 | from scapy.all import * 2 | from scapy.fields import * 3 | from scapy.packet import * 4 | 5 | """SOMEIP PACKAGE DEFINITION""" 6 | 7 | 8 | class _SOMEIP_MessageId(Packet): 9 | """MessageId subpacket.""" 10 | name = 'MessageId' 11 | fields_desc = [ 12 | # Service ID 13 | ShortField('srv_id', 0), 14 | # identify it is a method or event 15 | BitEnumField('sub_id', 0, 1, {0: 'METHOD_ID', 1: 'EVENT_ID'}), 16 | # the RPC call to a method of an application 17 | ConditionalField(BitField('method_id', 0, 15), lambda pkt: pkt.sub_id == 0), 18 | # identify an event 19 | ConditionalField(BitField('event_id', 0, 15), lambda pkt: pkt.sub_id == 1) 20 | ] 21 | 22 | def extract_padding(self, p): 23 | return '', p 24 | 25 | 26 | class _SOMEIP_RequestId(Packet): 27 | """ RequestId subpacket.""" 28 | name = 'RequestId' 29 | fields_desc = [ 30 | ShortField('client_id', 0), 31 | ShortField('session_id', 0)] 32 | 33 | # In case Session Handling is not active, the Session ID shall be set to 0x00 34 | # When the Session ID reaches 0xFFFF, it shall start with 0x0001 again. 35 | 36 | def extract_padding(self, p): 37 | return '', p 38 | 39 | 40 | class SOMEIP(Packet): 41 | """ SOME/IP Packet.""" 42 | # Default values 43 | PROTOCOL_VERSION = 0x01 44 | INTERFACE_VERSION = 0x01 45 | 46 | # Lenght offset (without payload) 47 | LEN_OFFSET = 0x08 48 | 49 | # SOME/IP TYPE VALUES 50 | TYPE_REQUEST = 0x00 # A request expecting a response 51 | TYPE_REQUEST_NO_RET = 0x01 # A fire&forget request 52 | TYPE_NOTIFICATION = 0x02 # A request of a notification/event callback expecting no response 53 | TYPE_REQUEST_ACK = 0x40 # Acknowledgment for REQUEST 54 | TYPE_REQUEST_NO_RET_ACK = 0x41 # Acknowledgment for REQUEST_NO_RETURN (informational) 55 | TYPE_NOTIFICATION_ACK = 0x42 # Acknowledgment for NOTIFICATION (informational) 56 | TYPE_RESPONSE = 0x80 # The response message 57 | TYPE_ERROR = 0x81 # The response containing an error 58 | TYPE_RESPONSE_ACK = 0xc0 # The Acknowledgment for RESPONSE (informational) 59 | TYPE_ERROR_ACK = 0xc1 # Acknowledgment for ERROR (informational) 60 | 61 | # SOME/IP-TP TYPE VALUES 62 | TYPE_REQUEST_SEGMENT = 0x20 # A TP request expecting a response (even void) 63 | TYPE_REQUEST_NO_RET_SEGMENT = 0x21 # A TP fire&forget request 64 | TYPE_NOTIFICATION_SEGMENT = 0x22 # A TP request of a notification/event callback expecting no response 65 | TYPE_RESPONSE_SEGMENT = 0xa0 # The TP response message 66 | TYPE_ERROR_SEGMENT = 0xa1 # The TP response containing an error 67 | SOMEIP_TP_TYPES = frozenset({TYPE_REQUEST_SEGMENT, TYPE_REQUEST_NO_RET_SEGMENT, TYPE_NOTIFICATION_SEGMENT, 68 | TYPE_RESPONSE_SEGMENT, TYPE_ERROR_SEGMENT}) 69 | # The 3rd highest bit of the Message Type (=0x20) shall be called TP-Flag and shall be set to 1 to signal 70 | # that the current SOME/IP message is a segment 71 | SOMEIP_TP_TYPE_BIT_MASK = 0x20 72 | 73 | # PS : 74 | # For all messages an optional acknowledgment (ACK) exists. These care defined for 75 | # transport protocols (i.e. UDP) that do not acknowledge a received message. ACKs 76 | # are only transported when the interface specification requires it. Only the usage of the 77 | # REQUEST_ACK is currently specified in this document. All other ACKs are currently 78 | # informational and do not need to be implemented 79 | 80 | # SOME/IP RETURN CODES 81 | # Message Type Allowed Return Codes 82 | # REQUEST N/A set to 0x00 (E_OK) 83 | # REQUEST_NO_RETURN N/A set to 0x00 (E_OK) 84 | # NOTIFICATION N/A set to 0x00 (E_OK) 85 | # RESPONSE See Return Codes in [TR_SOMEIP_00191] 86 | # ERROR See Return Codes in [TR_SOMEIP_00191]. Shall not be 0x00 (E_OK) 87 | RET_E_OK = 0x00 # No error occurred 88 | RET_E_NOT_OK = 0x01 # An unspecified error occurred 89 | RET_E_UNKNOWN_SERVICE = 0x02 # The requested Service ID is unknown 90 | RET_E_UNKNOWN_METHOD = 0x03 # The requested Method ID is unknown. Service ID is known. 91 | RET_E_NOT_READY = 0x04 # Service ID and Method ID are known. Application not running. 92 | RET_E_NOT_REACHABLE = 0x05 # System running the service is not reachable (internal error code only) 93 | RET_E_TIMEOUT = 0x06 # A timeout occurred (internal error code only). 94 | RET_E_WRONG_PROTOCOL_V = 0x07 # Version of SOME/IP protocol not supported 95 | RET_E_WRONG_INTERFACE_V = 0x08 # Interface version mismatch 96 | RET_E_MALFORMED_MSG = 0x09 # eserialization error, so that payload cannot be deserialized. 97 | RET_E_WRONG_MESSAGE_TYPE = 0x0a # An unexpected message type was received (e.g. REQUEST_NO_RETURN for a method defined as REQUEST.) 98 | RET_E_E2E_REPEATED = 0x0b # Repeated E2E calculation error 99 | RET_E_E2E_WRONG_SEQUENCE = 0x0c # Wrong E2E sequence error 100 | RET_E_E2E = 0x0d # Not further specified E2E error 101 | RET_E_E2E_NOT_AVAILABLE = 0x0e # E2E not available 102 | RET_E_E2E_NO_NEW_DATA = 0x0f # No new data for E2E calculation present. 103 | 104 | # SOME/IP-TP More Segments Flag 105 | SOMEIP_TP_LAST_SEGMENT = 0 106 | SOMEIP_TP_MORE_SEGMENTS = 1 107 | 108 | _OVERALL_LEN_NOPAYLOAD = 16 # UT 109 | 110 | name = 'SOME/IP' 111 | 112 | fields_desc = [ 113 | PacketField('msg_id', _SOMEIP_MessageId(), _SOMEIP_MessageId), # MessageID 114 | IntField('len', None), 115 | # Length contain the length in Byte starting from Request until the end of the SOME/IP message 116 | PacketField('req_id', _SOMEIP_RequestId(), _SOMEIP_RequestId), # RequestID 117 | ByteField('proto_ver', PROTOCOL_VERSION), # Protocol version 118 | ByteField('iface_ver', INTERFACE_VERSION), # Interface version 119 | ByteEnumField('msg_type', TYPE_REQUEST, { # -- Message type -- 120 | TYPE_REQUEST: 'REQUEST', # 0x00 121 | TYPE_REQUEST_NO_RET: 'REQUEST_NO_RETURN', # 0x01 122 | TYPE_NOTIFICATION: 'NOTIFICATION', # 0x02 123 | TYPE_REQUEST_ACK: 'REQUEST_ACK', # 0x40 124 | TYPE_REQUEST_NO_RET_ACK: 'REQUEST_NO_RETURN_ACK', # 0x41 125 | TYPE_NOTIFICATION_ACK: 'NOTIFICATION_ACK', # 0x42 126 | TYPE_RESPONSE: 'RESPONSE', # 0x80 127 | TYPE_ERROR: 'ERROR', # 0x81 128 | TYPE_RESPONSE_ACK: 'RESPONSE_ACK', # 0xc0 129 | TYPE_ERROR_ACK: 'ERROR_ACK', # 0xc1 130 | TYPE_REQUEST_SEGMENT: 'TP_REQUEST', # 0x20 131 | TYPE_REQUEST_NO_RET_SEGMENT: 'TP_REQUEST_NO_RETURN', # 0x21 132 | TYPE_NOTIFICATION_SEGMENT: 'TP_NOTIFICATION', # 0x22 133 | TYPE_RESPONSE_SEGMENT: 'TP_RESPONSE', # 0xa0 134 | TYPE_ERROR_SEGMENT: 'TP_ERROR', # 0xa1 135 | }), 136 | ByteEnumField('retcode', 0, { # -- Return code -- 137 | RET_E_OK: 'E_OK', # 0x00 138 | RET_E_NOT_OK: 'E_NOT_OK', # 0x01 139 | RET_E_UNKNOWN_SERVICE: 'E_UNKNOWN_SERVICE', # 0x02 140 | RET_E_UNKNOWN_METHOD: 'E_UNKNOWN_METHOD', # 0x03 141 | RET_E_NOT_READY: 'E_NOT_READY', # 0x04 142 | RET_E_NOT_REACHABLE: 'E_NOT_REACHABLE', # 0x05 143 | RET_E_TIMEOUT: 'E_TIMEOUT', # 0x06 144 | RET_E_WRONG_PROTOCOL_V: 'E_WRONG_PROTOCOL_VERSION', # 0x07 145 | RET_E_WRONG_INTERFACE_V: 'E_WRONG_INTERFACE_VERSION', # 0x08 146 | RET_E_MALFORMED_MSG: 'E_MALFORMED_MESSAGE', # 0x09 147 | RET_E_WRONG_MESSAGE_TYPE: 'E_WRONG_MESSAGE_TYPE', # 0x0a 148 | RET_E_E2E_REPEATED: 'E_E2E_REPEATED', # 0x0b 149 | RET_E_E2E_WRONG_SEQUENCE: 'E_E2E_WRONG_SEQUENCE', # 0x0c 150 | RET_E_E2E: 'E_E2E', # 0x0d 151 | RET_E_E2E_NOT_AVAILABLE: 'E_E2E_NOT_AVAILABLE', # 0x0e 152 | RET_E_E2E_NO_NEW_DATA: 'E_E2E_NO_NEW_DATA', # 0x0f 153 | }), 154 | # The Offset field shall be set to the offset n bytes of the transported segment in the original message 155 | # Please be aware that the value provided within the Offset Field is given in units of 16 bytes 156 | # The Offset Value of 87 correspond to 1392 bytes Payload. 157 | ConditionalField(BitField('offset', 0, 28), lambda pkt: pkt.msg_type in SOMEIP.SOMEIP_TP_TYPES), 158 | ConditionalField(BitField('reserved', 0, 3), lambda pkt: pkt.msg_type in SOMEIP.SOMEIP_TP_TYPES), 159 | # The More Segments Flag shall be set to 1 for all segments but the last segment. 160 | # For the last segment it shall be set to 0. 161 | ConditionalField(BitEnumField('more_segments', 0, 1, {SOMEIP_TP_LAST_SEGMENT: 'Last_Segment', 162 | SOMEIP_TP_MORE_SEGMENTS: 'More_Segments' 163 | }), lambda pkt: pkt.msg_type in SOMEIP.SOMEIP_TP_TYPES) 164 | ] 165 | 166 | def post_build(self, p, pay): 167 | length = self.len 168 | # length computation : RequestID + PROTOVER_IFACEVER_TYPE_RETCODE + PAYLOAD 169 | if length is None: 170 | length = self.LEN_OFFSET + len(pay) 171 | p = p[:4] + struct.pack('!I', length) + p[8:] 172 | return p + pay 173 | -------------------------------------------------------------------------------- /bin/protocol/SOMEIP_SD.py: -------------------------------------------------------------------------------- 1 | from scapy.all import * 2 | from scapy.layers.inet6 import IP6Field 3 | import ctypes 4 | import collections 5 | from .SOMEIP import SOMEIP 6 | 7 | 8 | class _SDPacketBase(Packet): 9 | """ base class to be used among all SD Packet definitions.""" 10 | # use this dictionary to set default values for desired fields (mostly on subclasses 11 | # where not all fields are defined locally) 12 | # - key : field_name, value : desired value 13 | # - it will be used from 'init_fields' function, upon packet initialization 14 | # 15 | # example : _defaults = {'field_1_name':field_1_value,'field_2_name':field_2_value} 16 | _defaults = {} 17 | 18 | def _set_defaults(self): 19 | """ goes through '_defaults' dict setting field default values (for those that have been defined).""" 20 | for key in self._defaults.keys(): 21 | try: 22 | self.get_field(key) 23 | except KeyError: 24 | pass 25 | else: 26 | self.setfieldval(key, self._defaults[key]) 27 | 28 | def init_fields(self): 29 | """ perform initialization of packet fields with desired values. 30 | NOTE : this funtion will only be called *once* upon class (or subclass) construction 31 | """ 32 | Packet.init_fields(self) 33 | self._set_defaults() 34 | 35 | 36 | # SD ENTRY 37 | # - Service 38 | # - EventGroup 39 | class _SDEntry(_SDPacketBase): 40 | """ Base class for SDEntry_* packages.""" 41 | TYPE_FMT = ">B" 42 | TYPE_PAYLOAD_I = 0 43 | # ENTRY TYPES : SERVICE 44 | TYPE_SRV_FINDSERVICE = 0x00 45 | TYPE_SRV_OFFERSERVICE = 0x01 46 | TYPE_SRV = (TYPE_SRV_FINDSERVICE, TYPE_SRV_OFFERSERVICE) 47 | # ENTRY TYPES : EVENGROUP 48 | TYPE_EVTGRP_SUBSCRIBE = 0x06 49 | TYPE_EVTGRP_SUBSCRIBE_ACK = 0x07 50 | TYPE_EVTGRP = (TYPE_EVTGRP_SUBSCRIBE, TYPE_EVTGRP_SUBSCRIBE_ACK) 51 | # overall len (UT usage) 52 | OVERALL_LEN = 16 53 | 54 | # fields_desc = [ 55 | # ByteField("type", 0), # Type Field[8bit] 用于表明Entry Type 56 | # ByteField("index_1", 0), # Index First Option Run[8bit] 在option array中运行的第一个选项的index 57 | # ByteField("index_2", 0), # Index Second Option Run[8bit] 在option array中运行的第二个选项的index 58 | # BitField("n_opt_1", 0, 4), # Number of Options 1[4bit] 第一个option array的数量 59 | # BitField("n_opt_2", 0, 4), # Number of Options 2[4bit] 第二个option array的数量 60 | # ShortField("srv_id", 0), # Service-ID[16bit] 61 | # ShortField("inst_id", 0), # Instance ID[16bit] 62 | # ByteField("major_ver", 0), # Major Version[8bit] 解码service instance的主要版本 63 | # X3BytesField("ttl", 0)] # TTL[24bit] 以秒为单位的生命周期 64 | 65 | def guess_payload_class(self, payload): 66 | """ decode SDEntry depending on its type.""" 67 | pl_type = struct.unpack(_SDEntry.TYPE_FMT, payload[_SDEntry.TYPE_PAYLOAD_I:_SDEntry.TYPE_PAYLOAD_I+1])[0] 68 | if pl_type in _SDEntry.TYPE_SRV: 69 | return SDEntry_Service 70 | elif pl_type in _SDEntry.TYPE_EVTGRP: 71 | return SDEntry_EventGroup 72 | 73 | 74 | class SDEntry_Service(_SDEntry): 75 | """ Service Entry.""" 76 | _defaults = {"type": _SDEntry.TYPE_SRV_FINDSERVICE} 77 | 78 | name = "Service Entry" 79 | fields_desc = [ 80 | ByteField("type", 0), # Type Field[8bit] 用于表明Entry Type 81 | ByteField("index_1", 0), # Index First Option Run[8bit] 在option array中运行的第一个选项的index 82 | ByteField("index_2", 0), # Index Second Option Run[8bit] 在option array中运行的第二个选项的index 83 | BitField("n_opt_1", 0, 4), # Number of Options 1[4bit] 第一个option array的数量 84 | BitField("n_opt_2", 0, 4), # Number of Options 2[4bit] 第二个option array的数量 85 | ShortField("srv_id", 0), # Service-ID[16bit] 86 | ShortField("inst_id", 0), # Instance ID[16bit] 87 | ByteField("major_ver", 0), # Major Version[8bit] 解码service instance的主要版本 88 | X3BytesField("ttl", 0), # TTL[24bit] 以秒为单位的生命周期 89 | IntField("minor_ver", 0)] # Minor Version[32bit] 解码service instance的次要版本 90 | 91 | 92 | class SDEntry_EventGroup(_SDEntry): 93 | """ EventGroup Entry.""" 94 | _defaults = {"type": _SDEntry.TYPE_EVTGRP_SUBSCRIBE} 95 | 96 | name = "Eventgroup Entry" 97 | fields_desc = [ 98 | ByteField("type", 0), # Type Field[8bit] 用于表明Entry Type 99 | ByteField("index_1", 0), # Index First Option Run[8bit] 在option array中运行的第一个选项的index 100 | ByteField("index_2", 0), # Index Second Option Run[8bit] 在option array中运行的第二个选项的index 101 | BitField("n_opt_1", 0, 4), # Number of Options 1[4bit] 第一个option array的数量 102 | BitField("n_opt_2", 0, 4), # Number of Options 2[4bit] 第二个option array的数量 103 | ShortField("srv_id", 0), # Service-ID[16bit] 104 | ShortField("inst_id", 0), # Instance ID[16bit] 105 | ByteField("major_ver", 0), # Major Version[8bit] 解码service instance的主要版本 106 | X3BytesField("ttl", 0), # TTL[24bit] 以秒为单位的生命周期 107 | BitField("res", 0, 12), # Reserved[12bit] 108 | BitField("cnt", 0, 4), # Counter[4bit] 用于区分同一订阅者相同的subscribe eventgroups (only difference in endpoint) 109 | ShortField("eventgroup_id", 0)] # Eventgroup ID[16bit] 传输Eventgroup的ID 110 | 111 | 112 | # SD Option 113 | # - Configuration 114 | # - LoadBalancing 115 | # - IPv4 EndPoint 116 | # - IPv6 EndPoint 117 | # - IPv4 MultiCast 118 | # - IPv6 MultiCast 119 | # - IPv4 EndPoint 120 | # - IPv6 EndPoint 121 | class _SDOption(_SDPacketBase): 122 | """ Base class for SDOption_* packages.""" 123 | TYPE_FMT = ">B" 124 | TYPE_PAYLOAD_I = 2 125 | 126 | CFG_TYPE = 0x01 # TYPE: configuration option 127 | CFG_OVERALL_LEN = 4 # overall length of CFG SDOption,empty 'cfg_str' (to be used from UT) 128 | LOADBALANCE_TYPE = 0x02 # TYPE: load balancing option 129 | LOADBALANCE_LEN = 0x05 # Length[16bit] 130 | LOADBALANCE_OVERALL_LEN = 8 # overall length of LB SDOption (to be used from UT) 131 | IP4_ENDPOINT_TYPE = 0x04 # TYPE: IPv4 Endpoint Option 132 | IP4_ENDPOINT_LEN = 0x0009 # Length[16bit] 133 | IP4_MCAST_TYPE = 0x14 # TYPE: IPv4 Multicast Option 134 | IP4_MCAST_LEN = 0x0009 # Length[16bit] 135 | IP4_SDENDPOINT_TYPE = 0x24 # TYPE: IPv4 SD Endpoint Option 136 | IP4_SDENDPOINT_LEN = 0x0009 # Length[16bit] 137 | IP4_OVERALL_LEN = 12 # overall length of IP4 SDOption (to be used from UT) 138 | IP6_ENDPOINT_TYPE = 0x06 # TYPE: IPv6 Endpoint Option 139 | IP6_ENDPOINT_LEN = 0x0015 # Length[16bit] 140 | IP6_MCAST_TYPE = 0x16 # TYPE: IPv6 Multicast Option 141 | IP6_MCAST_LEN = 0x0015 # Length[16bit] 142 | IP6_SDENDPOINT_TYPE = 0x26 # TYPE: IPv6 SD Endpoint Option 143 | IP6_SDENDPOINT_LEN = 0x0015 # Length[16bit] 144 | IP6_OVERALL_LEN = 24 # overall length of IP6 SDOption (to be used from UT) 145 | 146 | def guess_payload_class(self, payload): 147 | """ decode SDOption depending on its type.""" 148 | pl_type = struct.unpack(_SDOption.TYPE_FMT, payload[_SDOption.TYPE_PAYLOAD_I:_SDOption.TYPE_PAYLOAD_I+1])[0] 149 | 150 | if pl_type == _SDOption.CFG_TYPE: 151 | return SDOption_Config 152 | elif pl_type == self.LOADBALANCE_TYPE: 153 | return SDOption_LoadBalance 154 | elif pl_type == self.IP4_ENDPOINT_TYPE: 155 | return SDOption_IP4_EndPoint 156 | elif pl_type == self.IP4_MCAST_TYPE: 157 | return SDOption_IP4_Multicast 158 | elif pl_type == self.IP4_SDENDPOINT_TYPE: 159 | return SDOption_IP4_SD_EndPoint 160 | elif pl_type == self.IP6_ENDPOINT_TYPE: 161 | return SDOption_IP6_EndPoint 162 | elif pl_type == self.IP6_MCAST_TYPE: 163 | return SDOption_IP6_Multicast 164 | elif pl_type == self.IP6_SDENDPOINT_TYPE: 165 | return SDOption_IP6_SD_EndPoint 166 | 167 | 168 | class _SDOption_Header(_SDOption): 169 | fields_desc = [ 170 | ShortField("len", None), # Length 从Reserved开始到Option结束的长度 171 | ByteField("type", 0), # Type 用于判断Option的格式 172 | ByteField("res_hdr", 0)] # Reserved 应该设置为0x00 173 | 174 | 175 | class _SDOption_Tail(_SDOption): 176 | fields_desc = [ 177 | ByteField("res_tail", 0), # Reserved 应该设置为0x00 178 | ByteEnumField("l4_proto", 0x06, {0x06: "TCP", 0x11: "UDP"}), # Transport Protocol[8bit] 用于判断传输层协议 179 | ShortField("port", 0)] # Transport Protocol Port Number[16bit] 180 | 181 | 182 | class _SDOption_IP4(_SDOption): 183 | fields_desc = [ 184 | _SDOption_Header, 185 | IPField("addr", "0.0.0.0"), 186 | _SDOption_Tail] 187 | 188 | 189 | class _SDOption_IP6(_SDOption): 190 | fields_desc = [ 191 | _SDOption_Header, 192 | IP6Field("addr", "2001:cdba:0000:0000:0000:0000:3257:9652"), 193 | _SDOption_Tail] 194 | 195 | 196 | class SDOption_Config(_SDOption): 197 | # offset to be added upon length calculation (corresponding to header's "Reserved" field) 198 | LEN_OFFSET = 0x01 199 | 200 | name = "Config Option" 201 | # default values specification 202 | _defaults = {'type': _SDOption.CFG_TYPE} 203 | # package fields definiton 204 | fields_desc = [ 205 | _SDOption_Header, 206 | StrField("cfg_str", "")] 207 | 208 | def post_build(self, p, pay): 209 | # length computation excluding 16b_length and 8b_type 210 | l = self.len 211 | if l is None: 212 | l = len(self.cfg_str) + self.LEN_OFFSET 213 | p = struct.pack("!H", l) + p[2:] 214 | return p + pay 215 | 216 | 217 | class SDOption_LoadBalance(_SDOption): 218 | name = "LoadBalance Option" 219 | # default values specification 220 | _defaults = {'type': _SDOption.LOADBALANCE_TYPE, 221 | 'len': _SDOption.LOADBALANCE_LEN} 222 | # package fields definiton 223 | fields_desc = [ 224 | _SDOption_Header, 225 | ShortField("priority", 0), # Priority[16bit] 值越低优先级越高 226 | ShortField("weight", 0)] # Weight[16bit] 值越大表明越有可能被选中 227 | 228 | 229 | # SDOPTIONS : IPv4-specific 230 | class SDOption_IP4_EndPoint(_SDOption_IP4): 231 | name = "IP4 EndPoint Option" 232 | # default values specification 233 | _defaults = {'type': _SDOption.IP4_ENDPOINT_TYPE, 'len': _SDOption.IP4_ENDPOINT_LEN} 234 | 235 | 236 | class SDOption_IP4_Multicast(_SDOption_IP4): 237 | name = "IP4 Multicast Option" 238 | # default values specification 239 | _defaults = {'type': _SDOption.IP4_MCAST_TYPE, 'len': _SDOption.IP4_MCAST_LEN} 240 | 241 | 242 | class SDOption_IP4_SD_EndPoint(_SDOption_IP4): 243 | name = "IP4 SDEndPoint Option" 244 | # default values specification 245 | _defaults = {'type': _SDOption.IP4_SDENDPOINT_TYPE, 'len': _SDOption.IP4_SDENDPOINT_LEN} 246 | 247 | 248 | # SDOPTIONS : IPv6-specific 249 | class SDOption_IP6_EndPoint(_SDOption_IP6): 250 | name = "IP6 EndPoint Option" 251 | # default values specification 252 | _defaults = {'type': _SDOption.IP6_ENDPOINT_TYPE, 'len': _SDOption.IP6_ENDPOINT_LEN} 253 | 254 | 255 | class SDOption_IP6_Multicast(_SDOption_IP6): 256 | name = "IP6 Multicast Option" 257 | # default values specification 258 | _defaults = {'type': _SDOption.IP6_MCAST_TYPE, 'len': _SDOption.IP6_MCAST_LEN} 259 | 260 | 261 | class SDOption_IP6_SD_EndPoint(_SDOption_IP6): 262 | name = "IP6 SDEndPoint Option" 263 | # default values specification 264 | _defaults = {'type': _SDOption.IP6_SDENDPOINT_TYPE, 'len': _SDOption.IP6_SDENDPOINT_LEN} 265 | 266 | 267 | # 268 | # SD PACKAGE DEFINITION 269 | # 270 | class SD(_SDPacketBase): 271 | """ 272 | SD Packet 273 | 274 | NOTE : when adding 'entries' or 'options', do not use list.append() method but create a new list 275 | e.g. : p = SD() 276 | p.option_array = [SDOption_Config(),SDOption_IP6_EndPoint()] 277 | """ 278 | # Message ID[32bit] value=0xFFFF 8100 279 | SOMEIP_MSGID_SRVID = 0xffff 280 | SOMEIP_MSGID_SUBID = 0x1 281 | SOMEIP_MSGID_EVENTID = 0x100 282 | 283 | SOMEIP_PROTO_VER = 0x01 # Protocol Version[8bit] 284 | SOMEIP_IFACE_VER = 0x01 # Interface Version[8bit] 285 | SOMEIP_MSG_TYPE = SOMEIP.TYPE_NOTIFICATION # Message Type[8bit] value=0x02 NOTIFICATION 286 | 287 | name = "SD" 288 | # Flags definition: {"name":(mask,offset)} 289 | _sdFlag = collections.namedtuple('Flag', 'mask offset') 290 | FLAGSDEF = { 291 | "REBOOT": _sdFlag(mask=0x80, offset=7), # ReBoot flag 用于表明是否发生ECU重启、Link down 292 | "UNICAST": _sdFlag(mask=0x40, offset=6) # UniCast flag 支持使用单播接受 293 | } 294 | 295 | fields_desc = [ 296 | ByteField("flags", 0), # Flags[8bit] 297 | X3BytesField("res", 0), # Reserved[24bit] 298 | FieldLenField("len_entry_array", None, length_of="entry_array", fmt="!I"), # Length of Entries Array[32bit] 299 | PacketListField("entry_array", None, cls=_SDEntry, length_from=lambda pkt:pkt.len_entry_array), # Entries Array[variable size] 300 | FieldLenField("len_option_array", None, length_of="option_array", fmt="!I"), # Length of Options Array[32bit] 301 | PacketListField("option_array", None, cls=_SDOption, length_from=lambda pkt:pkt.len_option_array)] # Options Array[variable size] 302 | 303 | def __init__(self, *args, **kwargs): 304 | super(SD, self).__init__(*args, **kwargs) 305 | self.explicit = 1 306 | 307 | def getFlag(self, name): 308 | """ get particular flag from bitfield.""" 309 | name = name.upper() 310 | if name in self.FLAGSDEF: 311 | return (self.flags & self.FLAGSDEF[name].mask) >> self.FLAGSDEF[name].offset 312 | else: 313 | return None 314 | 315 | def setFlag(self, name, value): 316 | """ 317 | 用于设置SOMEIP header之后的Flags[8bit],Flags中包含两个标志位Reboot Flag和Unicast Flag 318 | param str name : name of the flag to set (see SD.FLAGSDEF) 319 | :param int value : either 0x1 or 0x0 (provided int will be ANDed with 0x01) 320 | """ 321 | name = name.upper() 322 | if name in self.FLAGSDEF: 323 | self.flags = ((self.flags & ctypes.c_ubyte(~self.FLAGSDEF[name].mask).value) | 324 | (value & 0x01) << self.FLAGSDEF[name].offset) 325 | 326 | def setEntryArray(self, entry_list): 327 | """ 328 | Add entries to entry_array. 329 | :param entry_list: list of entries to be added. Single entry object also accepted 330 | """ 331 | if isinstance(entry_list, list): 332 | self.entry_array = entry_list 333 | else: 334 | self.entry_array = [entry_list] 335 | 336 | def setOptionArray(self, option_list): 337 | """ 338 | Add options to option_array. 339 | :param option_list: list of options to be added. Single option object also accepted 340 | """ 341 | if isinstance(option_list, list): 342 | self.option_array = option_list 343 | else: 344 | self.option_array = [option_list] 345 | 346 | def getSomeip(self, stacked=False): 347 | """ 348 | return SD-initialized SOME/IP packet 349 | :param stacked: boolean. Either just SOME/IP packet or stacked over SD-self 350 | """ 351 | p = SOMEIP() 352 | p.msg_id.srv_id = SD.SOMEIP_MSGID_SRVID 353 | p.msg_id.sub_id = SD.SOMEIP_MSGID_SUBID 354 | p.msg_id.event_id = SD.SOMEIP_MSGID_EVENTID 355 | p.proto_ver = SD.SOMEIP_PROTO_VER 356 | p.iface_ver = SD.SOMEIP_IFACE_VER 357 | p.msg_type = SD.SOMEIP_MSG_TYPE 358 | 359 | if stacked: 360 | return p / self 361 | else: 362 | return p 363 | -------------------------------------------------------------------------------- /bin/protocol/__pycache__/SOMEIP.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/bin/protocol/__pycache__/SOMEIP.cpython-39.pyc -------------------------------------------------------------------------------- /bin/protocol/__pycache__/SOMEIP_SD.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/bin/protocol/__pycache__/SOMEIP_SD.cpython-39.pyc -------------------------------------------------------------------------------- /bin/transceiver/sender.py: -------------------------------------------------------------------------------- 1 | from scapy.layers.inet import IP, UDP, TCP 2 | from scapy.layers.l2 import Ether 3 | from scapy.all import * 4 | from ..protocol import SOMEIP 5 | from ..protocol import SOMEIP_SD 6 | 7 | 8 | class Sender: 9 | def __init__(self, src: dict, dst: dict, protocol: str): 10 | """ 11 | Used to set the three layers below someip or someipsd 12 | :param src:This dictionary must contain the keys 'ip', 'port','iface'(the interface to send the packets on) 13 | :param dst:This dictionary must contain the keys 'ip', 'port' 14 | :param protocol: 'udp' or 'tcp' 15 | """ 16 | self.initFlag = 0 17 | self.src = src 18 | self.dst = dst 19 | self.protocol = protocol 20 | self._build_l3_layer() 21 | self.initFlag = 1 22 | 23 | @property 24 | def src(self): 25 | return self._src 26 | 27 | @src.setter 28 | def src(self, value: dict): 29 | if "ip" not in value or "port" not in value: 30 | raise ValueError("key missing 'ip' or 'port'") 31 | if "iface" not in value: 32 | raise ValueError("key missing 'iface'") 33 | self._src = value 34 | if self.initFlag: 35 | self._build_l3_layer() 36 | 37 | @property 38 | def dst(self): 39 | return self._dst 40 | 41 | @dst.setter 42 | def dst(self, value: dict): 43 | if "ip" not in value or "port" not in value: 44 | raise ValueError("key missing 'ip' or 'port'") 45 | self._dst = value 46 | if self.initFlag: 47 | self._build_l3_layer() 48 | 49 | @property 50 | def protocol(self): 51 | return self._protocol 52 | 53 | @protocol.setter 54 | def protocol(self, value: str): 55 | if value.lower() == "udp" or value.lower() == "tcp": 56 | self._protocol = value.lower() 57 | else: 58 | raise ValueError("protocol must be tcp or udp") 59 | if self.initFlag: 60 | self._build_l3_layer() 61 | 62 | def _build_l3_layer(self): 63 | if self.protocol == "udp": 64 | self.l3Layer = Ether() / IP(src=self.src["ip"], dst=self.dst["ip"]) / UDP(sport=self.src["port"], 65 | dport=self.dst["port"]) 66 | else: 67 | self.l3Layer = Ether() / IP(src=self.src["ip"], dst=self.dst["ip"]) / TCP(sport=self.src["port"], 68 | dport=self.dst["port"]) 69 | 70 | def send(self, package, flag=True): 71 | """ 72 | Send the someip or someipsd 73 | :param package: 74 | :param flag: 75 | :return: 76 | """ 77 | if type(package) == SOMEIP_SD.SD: 78 | package = package.getSomeip(flag) 79 | sendp(self.l3Layer/package, iface=self.src["iface"]) 80 | 81 | 82 | -------------------------------------------------------------------------------- /bin/transceiver/sniffer.py: -------------------------------------------------------------------------------- 1 | from ..protocol import SOMEIP 2 | from ..protocol import SOMEIP_SD 3 | from scapy.all import * 4 | import queue 5 | 6 | 7 | 8 | class Sniffer(object): 9 | def __init__(self, netName: str, filter: str, queue: queue.Queue): 10 | """ 11 | Listen for SOMEIP/SOMEIPSD messages and expose them to users after parsing 12 | :param netName: NIC name 13 | :param filter: BPF filter to apply (Please make sure that only someip or someipsd packets exist after filtering) 14 | :param queue: 15 | """ 16 | self.queue = queue 17 | self.sniffer = AsyncSniffer(iface=netName, filter=filter, prn=self.guess_payload_class, count=0) 18 | self.sniffer.start() 19 | 20 | def stop(self): 21 | """ 22 | Stop listening for SOMEIP/SOMEIPSD messages 23 | :return: 24 | """ 25 | if self.sniffer.running: 26 | self.sniffer.stop(False) 27 | 28 | def __del__(self): 29 | self.stop() 30 | 31 | def guess_payload_class(self, packet): 32 | sd_header = b"\xff\xff\x81\x00" 33 | raw_data = raw(packet.getlayer(scapy.packet.Raw)) 34 | if raw_data[:4] == sd_header: 35 | last_layer = SOMEIP.SOMEIP(raw_data[:16])/SOMEIP_SD.SD(raw_data[16:]) 36 | else: 37 | last_layer = SOMEIP.SOMEIP(raw_data) 38 | # last_layer.show() 39 | self.queue.put(last_layer) 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /demo/snifferDemo.py: -------------------------------------------------------------------------------- 1 | import SOMEIP 2 | import queue 3 | 4 | 5 | if __name__ == "__main__": 6 | queueObj = queue.Queue() 7 | 8 | ifacestr = "enp0s3" # Network port name, you need to change this variable to your own network card name 9 | filterstr = "udp port 30490" # BPF filter to apply (Please make sure that only someip or someipsd packets exist after filtering) 10 | 11 | sniffer = SOMEIP.Sniffer(ifacestr, filterstr, queueObj) 12 | while True: 13 | if not queueObj.empty(): 14 | print("=================================") 15 | resp = queueObj.get() 16 | # print the detail of the resp 17 | resp.show() 18 | print("=================================") 19 | 20 | -------------------------------------------------------------------------------- /demo/someipDemo.py: -------------------------------------------------------------------------------- 1 | import SOMEIP 2 | 3 | if __name__ == "__main__": 4 | sender = SOMEIP.Sender({"ip": "192.168.67.65", "port": 30490, "iface": "vEthernet"}, 5 | {"ip": "192.168.67.65", "port": 30490}, "udp") 6 | 7 | # build someip packet 8 | sip = SOMEIP.SOMEIP() 9 | sip.msg_id.srv_id = 0xffff 10 | sip.msg_id.sub_id = 0x1 11 | sip.msg_id.event_id = 0x0110 12 | sip.req_id.client_id = 0xdead 13 | sip.req_id.session_id = 0xbeef 14 | sip.msg_type = 0x02 15 | sip.retcode = 0x00 16 | sip.add_payload(b"payloadDemo") 17 | 18 | # send message 19 | sender.send(sip) 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /demo/someipsdDemo.py: -------------------------------------------------------------------------------- 1 | 2 | import SOMEIP 3 | 4 | if __name__ == "__main__": 5 | sender = SOMEIP.Sender({"ip": "192.168.67.65", "port": 30490, "iface": "vEthernet"}, 6 | {"ip": "192.168.67.65", "port": 30490}, "udp") 7 | 8 | # build someipsd packet 9 | sdp = SOMEIP.SD() 10 | 11 | sdp.flags = 0x00 12 | # add the entry_array 13 | sdp.entry_array = [ 14 | SOMEIP.SDEntry_EventGroup(srv_id=0x1234, n_opt_1=1, inst_id=0x1234, major_ver=0x03, eventgroup_id=0x04, cnt=0x0, 15 | ttl=0x05), 16 | SOMEIP.SDEntry_Service(srv_id=0x4321, index_1=1, n_opt_1=1, inst_id=0x4321, major_ver=0x03, minor_ver=0x1, 17 | ttl=0x04)] 18 | # add the option_array 19 | sdp.option_array = [ 20 | SOMEIP.SDOption_IP4_EndPoint(addr="192.168.0.1", l4_proto=0x11, port=0xd903), 21 | SOMEIP.SDOption_IP6_EndPoint(addr="ff88::8888:8888:8888:8888", l4_proto=0x11, port=0x0201)] 22 | 23 | sender.send(sdp) 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /docs/AUTOSAR_TR_SomeIpExample_4.2.1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/docs/AUTOSAR_TR_SomeIpExample_4.2.1.pdf -------------------------------------------------------------------------------- /docs/SD/AUTOSAR_PRS_SOMEIPServiceDiscoveryProtocol.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/docs/SD/AUTOSAR_PRS_SOMEIPServiceDiscoveryProtocol.pdf -------------------------------------------------------------------------------- /docs/SD/AUTOSAR_SWS_ServiceDiscovery.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/docs/SD/AUTOSAR_SWS_ServiceDiscovery.pdf -------------------------------------------------------------------------------- /docs/SOMEIP/AUTOSAR_PRS_SOMEIPProtocol.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/docs/SOMEIP/AUTOSAR_PRS_SOMEIPProtocol.pdf -------------------------------------------------------------------------------- /docs/SOMEIP/AUTOSAR_SWS_CommunicationManagement.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/docs/SOMEIP/AUTOSAR_SWS_CommunicationManagement.pdf -------------------------------------------------------------------------------- /docs/SOMEIP/AUTOSAR_SWS_SOMEIPTransformer.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/docs/SOMEIP/AUTOSAR_SWS_SOMEIPTransformer.pdf -------------------------------------------------------------------------------- /nootbook/Allowed Option Types for Entry Types.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/Allowed Option Types for Entry Types.png -------------------------------------------------------------------------------- /nootbook/Entry types.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/Entry types.png -------------------------------------------------------------------------------- /nootbook/Flags in SOMEIP-SD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/Flags in SOMEIP-SD.png -------------------------------------------------------------------------------- /nootbook/Message Validation and Error Handling in SOMEIP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/Message Validation and Error Handling in SOMEIP.png -------------------------------------------------------------------------------- /nootbook/Notification interaction.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/Notification interaction.png -------------------------------------------------------------------------------- /nootbook/Overview of currently supported Entry Types.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/Overview of currently supported Entry Types.png -------------------------------------------------------------------------------- /nootbook/Publish Subscribe Registration Deregistration behavior(figure ignoring timings).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/Publish Subscribe Registration Deregistration behavior(figure ignoring timings).png -------------------------------------------------------------------------------- /nootbook/Publish Subscribe Example for Endpoint Options and the usage of ports.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/Publish Subscribe Example for Endpoint Options and the usage of ports.png -------------------------------------------------------------------------------- /nootbook/Publish Subscribe State Diagram (overall behavior).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/Publish Subscribe State Diagram (overall behavior).png -------------------------------------------------------------------------------- /nootbook/Publish Subscribe State Diagram (server behavior for unicast eventgroups).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/Publish Subscribe State Diagram (server behavior for unicast eventgroups).png -------------------------------------------------------------------------------- /nootbook/Publish Subscribe State Diagram(server behavior for adaptive unicastmulticast eventgroups).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/Publish Subscribe State Diagram(server behavior for adaptive unicastmulticast eventgroups).png -------------------------------------------------------------------------------- /nootbook/Publish Subscribe State Diagram(server behavior for multicast) .png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/Publish Subscribe State Diagram(server behavior for multicast) .png -------------------------------------------------------------------------------- /nootbook/Publish Subscribe with link loss at server(figure ignoring timings).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/Publish Subscribe with link loss at server(figure ignoring timings).png -------------------------------------------------------------------------------- /nootbook/Publish or Subscribe with link loss at client(figure ignoring timings).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/Publish or Subscribe with link loss at client(figure ignoring timings).png -------------------------------------------------------------------------------- /nootbook/SOMEIP Header Format.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP Header Format.png -------------------------------------------------------------------------------- /nootbook/SOMEIP Service State Machine Client(Update).png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP Service State Machine Client(Update).png -------------------------------------------------------------------------------- /nootbook/SOMEIP Service State Machine Client.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP Service State Machine Client.png -------------------------------------------------------------------------------- /nootbook/SOMEIP Service State Machine Server.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP Service State Machine Server.png -------------------------------------------------------------------------------- /nootbook/SOMEIP-SD Configuration Option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP-SD Configuration Option.png -------------------------------------------------------------------------------- /nootbook/SOMEIP-SD Dependencies.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP-SD Dependencies.png -------------------------------------------------------------------------------- /nootbook/SOMEIP-SD Error Handling.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP-SD Error Handling.png -------------------------------------------------------------------------------- /nootbook/SOMEIP-SD Eventgroup Entry Type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP-SD Eventgroup Entry Type.png -------------------------------------------------------------------------------- /nootbook/SOMEIP-SD Example PDU for Non-SOMEIP-SD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP-SD Example PDU for Non-SOMEIP-SD.png -------------------------------------------------------------------------------- /nootbook/SOMEIP-SD Example PDU.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP-SD Example PDU.png -------------------------------------------------------------------------------- /nootbook/SOMEIP-SD Header Format.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP-SD Header Format.png -------------------------------------------------------------------------------- /nootbook/SOMEIP-SD IPv4 Endpoint Option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP-SD IPv4 Endpoint Option.png -------------------------------------------------------------------------------- /nootbook/SOMEIP-SD IPv4 Multicast Option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP-SD IPv4 Multicast Option.png -------------------------------------------------------------------------------- /nootbook/SOMEIP-SD IPv4 SD Endpoint Option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP-SD IPv4 SD Endpoint Option.png -------------------------------------------------------------------------------- /nootbook/SOMEIP-SD IPv6 Endpoint Option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP-SD IPv6 Endpoint Option.png -------------------------------------------------------------------------------- /nootbook/SOMEIP-SD IPv6 Multicast Option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP-SD IPv6 Multicast Option.png -------------------------------------------------------------------------------- /nootbook/SOMEIP-SD Load Balancing Option.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP-SD Load Balancing Option.png -------------------------------------------------------------------------------- /nootbook/SOMEIP-SD Service Entry Type.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP-SD Service Entry Type.png -------------------------------------------------------------------------------- /nootbook/SOMEIP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YueZeJun/SOMEIP/4fcaf52537f613238254a2a3db4b82967bdbcf3e/nootbook/SOMEIP.png -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | SOMEIP 2 | ====== 3 | ***************************************************************************************** 4 | 概述:
5 | 支持 SOME/IP 数据包的发送、接收并解析
6 | 使用它你可以发送任何你想要的someip/someipsd 数据包
7 | 复制到你的python环境的Lib\site-packages目录下,然后就可以直接在代码中'import SOMEIP'并使用了
8 |
9 | Overview:
10 | Supports sending, receiving and parsing of SOME/IP packets
11 | With it you can send any someip/someipsd packets you wanted
12 | Copy it to the Lib\site-packages directory of your python environment, then you can directly import the library to use
13 | ***************************************************************************************** 14 | 如下是项目的层级结构/Below is the project structure:
15 | |->bin
16 |   |->protocol
17 |     |->SOMEIP.py     SOME/IP 类消息定义|SOME/IP class message definition
18 |     |->SOMEIP_SD.py    SOME/IP-SD 类消息定义|SOME/IP-SD class message definition
19 |   |->transceiver
20 |     |->sender.py   发送器|Send someip/someipsd packets
21 |     |->sniffer.py   监听器|Monitor, parse and deliver someip/someipsd packets
22 | |->demo
23 |   |->snifferDemo.py   监听器监听someip/someipsd报文|Use sniffer to listen to someip/someipsd
24 |   |->someipDemo.py   发送器发送someip报文|Use sender to send someip packets
25 |   |->someipsdDemo.py   发送器发送someipsd报文|Use sender to send someipsd packets
26 | |->docs         官方文档|Official documentation
27 | |->notebook       关键流程图以及总结的思维导图|Relevant flowcharts and mind maps
28 | ***************************************************************************************** 29 | 参考代码/Reference Code:
30 | https://github.com/jamores/eth-scapy-someip
31 | 32 | 参考文档/Reference documentation:
33 | AUTOSAR_TR_SomeIpExample_4.2.1.pdf
34 | AUTOSAR_PRS_SOMEIPServiceDiscoveryProtocol.pdf
35 | AUTOSAR_PRS_SOMEIPProtocol.pdf
36 | ***************************************************************************************** 37 | editor:YueZeJun
38 | email:sir.yue@qq.com
39 | 40 | ![qrcode](https://github.com/YueZeJun/SOMEIP/blob/dev/QRcode.png) 41 | --------------------------------------------------------------------------------