linux 汽车 计算机网络 开发语言 VSOMEIP-配置文件-json文件 - port&#34

📅 2026-11-30 👤 拼多多助力营销技巧 📂 拼多多助力神器 👁️ 370 次阅读

首先我们得看一下环境变量VSOMEIP_CONFIGURATION,根据用户手册

* `VSOMEIP_CONFIGURATION`: vsomeip uses the default configuration file `/etc/vsomeip.json`

and/or the default configuration folder `/etc/vsomeip`. This can be overridden by a

local configuration file `./vsomeip.json` and/or a local configuration folder `./vsomeip`.

If `VSOMEIP_CONFIGURATION` is set to a valid file or directory path, this is used instead

of the standard configuration (thus neither default nor local file/folder will be parsed).

vsomeip默认使用配置文件 /etc/vsomeip.json或者包含配置文件的文件夹/etc/vsomeip,如果当前目录存在 /etc/vsomeip.json或者包含配置文件的文件夹/etc/vsomeip,优先使用当前目录的配置文件,用户可通过配置VSOMEIP_CONFIGURATION环境变量覆盖当前和默认的配置文件。

我们来看一下配置文件内容,以上篇文章的配置文件为例:

{

"unicast":"192.168.4.1",

"netmask":"255.255.255.0",

"network":"vsomeip",

"logging":

{

"level":"debug",

"console":"true",

"dlt":"true"

},

"applications":

[

{

"name":"service1",

"id":"0x1000"

},

{

"name":"service2",

"id":"0x2000"

}

],

"services":

[

{

"service":"0x1001",

"instance":"0x0001",

"unicast":"192.168.4.1", 拼多多帮助力入口

"unreliable":"40001",

"reliable" : { "port" : "40001", "enable-magic-cookies" : "false" },

"multicast" :

{

"address" : "239.0.4.1",

"port" : "40001"

},

"events" :

[

{

"event" : "0x9001",

"is_field" : "true",

"is_reliable" : "false"

},

{

"event" : "0x9002",

"is_field" : "true",

"is_reliable" : "false"

},

{

"event" : "0x9003",

"is_field" : "true",

"is_reliable" : "false"

}

],

"eventgroups" :

[

{

"eventgroup" : "0x0005",

"events" : [ "0x9001", "0x9002", "0x9003"],

"is_multicast" : "false"

}

]

},

{

"service":"0x2001",

"instance":"0x0001",

"unicast":"192.168.4.1",

"unreliable":"40002",

"reliable" : { "port" : "40002", "enable-magic-cookies" : "false" },

"multicast" :

{

"address" : "239.0.4.1",

"port" : "40002"

},

"events" :

[

{

"event" : "0x9001",

"is_field" : "true",

"is_reliable" : "false"

},

{

"event" : "0x9002",

"is_field" : "true",

"is_reliable" : "false"

},

{

"event" : "0x9003",

"is_field" : "true",

"is_reliable" : "false"

},

{

"event" : "0x9004",

"is_field" : "true",

"is_reliable" : "false"

}

],

"eventgroups" :

[

{

"eventgroup" : "0x0006",

"events" : [ "0x9001", "0x9002", "0x9003", "0x9004"],

"is_multicast" : "false"

},

{

"eventgroup" : "0x0007",

"events" : [ "0x9001" ],

"is_multicast" : "false"

}

]

}

],

"routing":"service1",

"service-discovery":

{

"enable" : "true",

"multicast" : "239.0.4.1",

"port" : "30490",

"protocol" : "udp",

"initial_delay_min" : "100",

"initial_delay_max" : "1000",

"repetitions_base_delay" : "30",

"repetitions_max" : "5",

"ttl" : "5",

"cyclic_offer_delay" : "1000"

}

}

"unicast":本机的IP地址 192.168.4.1 "netmask":本机的掩码 255.255.255.0 "network":用于本机存在多个routing managers的场景,参数可以修改/dev/shm共享内存的字段以及/tmp下socket的名字,默认该参数为vsomeip, 对应共享内存为/dev/shm/vsomeip,socket命名为/tmp/vsomeip-$CLIENTID。

日志模块logging

"level":配置日志的级别,可选的配置有:trace,debug,info,warnning,error,fatal "console":日志是否通过控制台输出,可选的配置有 true,false "file":有两个参数

enable:是否创建一个log文件, 可选的值为true,false

path: 用于存放生成的日志文件的绝对路径

"dlt":配置是否使用Diagnostic Log and Trace(DLT),可选的值有true,false

应用模块applications:

"name":应用的名字"id":应用程序的ID

服务模块services:

"service":服务的ID"instance": instance ID"unicast": 服务实例的单播地址"reliable": 用于TCP服务

port:tcp endpoint的端口号

enable-magic-cookies: 是否使用magic cookies(可选 true false)

"unreliable":用于UDP服务,UDP的端口号"multicast": 用于发布eventgroup

address:组播IP地址

port:组播端口号

"events": 服务的events

event: event ID

is_field: 配置该event是否为filed类型

is_reliable:配置该event是否为tcp(true false)

"eventgroups": 事件组

eventgroup: 事件组ID

events: 包含的event id

multicast: 是否支持组播(true false)

"routing": 字符串(应用的名字),配置routing manager

服务发现模块service-discovery

"enable": 配置服务发现模块是否使能(true,false)"multicast": 服务发现使用的组播地址"port": 服务发现使用的端口号"protocol": 服务发现使用的协议(tcp udp)"initial_delay_min": Minimum delay before first offer message."initial_delay_max": Maximum delay before first offer message."repetitions_base_delay": Base delay sending offer messages within the repetition phase."repetitions_max": Maximum number of repetitions for provided services within the repetition phase."ttl": Lifetime of entries for provided services as well as consumed services and eventgroups."cyclic_offer_delay": Cycle of the OfferService messages in the main phase.

好文链接

标签: 拼多多助力网站平台 赚钱项目 拼多多助力网 首码项目 手赚APP
拼多多助力营销技巧