renderer: fix passpoint support

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2021-07-02 08:42:17 +02:00
parent 730aaaf4a2
commit de4e2a6352
5 changed files with 53 additions and 56 deletions

View File

@@ -11,4 +11,4 @@ mkdir -p docs
generate-schema-doc --config expand_buttons=true ucentral.schema.pretty.json docs/ucentral-schema.html
generate-schema-doc --config expand_buttons=true ucentral.state.pretty.json docs/ucentral-state.html
./generate-reader.uc > schemareader.uc
./generate-example.uc > input.json
#./generate-example.uc > input.json

View File

@@ -277,7 +277,7 @@ set wireless.{{ section }}.rssi_ignore_probe_request={{ ssid.quality_thresholds.
{% endif %}
{% if (ssid.pass_point): %}
set wireless.{{ section }}.iw_enable=1
set wireless.{{ section }}.iw_enabled=1
set wireless.{{ section }}.hs20=1
{% for (let name in ssid.pass_point.venue_name): %}
add_list wireless.{{ section }}.iw_venue_name={{ s(name) }}
@@ -294,12 +294,22 @@ set wireless.{{ section }}.iw_nai_realm='{{ realm }}'
{% endfor %}
set wireless.{{ section }}.osen={{ b(ssid.pass_point.osen) }}
set wireless.{{ section }}.anqp_domain_id='{{ ssid.pass_point.anqp_domain }}'
set wireless.{{ section }}.anqp_3gpp_cell_net='{{ ssid.anqp_3gpp_cell_net }}'
{% for (let cell_net in ssid.pass_point.anqp_3gpp_cell_net): %}
add_list wireless.{{ section }}.iw_anqp_3gpp_cell_net='{{ s(cell_net) }}'
{% endfor %}
{% for (let name in ssid.pass_point.friendly_name): %}
add_list wireless.{{ section }}.hs20_oper_friendly_name={{ s(name) }}
{% endfor %}
{% for (let icon in ssid.pass_point.icon): %}
add_list wireless.{{ section }}.operator_icon={{ s(icon.uri) }}
{% endif %}
{% if (ssid.pass_point): %}
{% for (let id, icon in ssid.pass_point.icons): %}
add wireless hs20-icon
set wireless.@hs20-icon[-1].width={{ s(icon.width) }}
set wireless.@hs20-icon[-1].height={{ s(icon.height) }}
set wireless.@hs20-icon[-1].type={{ s(icon.type) }}
set wireless.@hs20-icon[-1].lang={{ s(icon.language) }}
set wireless.@hs20-icon[-1].path={{ s(files.add_anonymous(location, 'hs20_icon_' + id, b64dec(icon.icon))) }}
{% endfor %}
{% endif %}

View File

@@ -77,7 +77,9 @@ properties:
anqp-3gpp-cell-net:
description:
The ANQP 3GPP Cellular Network information.
type: string
type: array
items:
type: string
friendly-name:
description:
This parameter can be used to configure one or more Operator Friendly
@@ -85,7 +87,7 @@ properties:
type: array
items:
type: string
icon:
icons:
description:
The operator icons.
type: array
@@ -107,12 +109,10 @@ properties:
description: The mimetype of the operator icon
examples:
- image/png
uri:
icon:
type: string
format: uri
description: The URL the operator icon is available at
examples:
- http://example.org/operator-64x64.png
format: uc-base64
description: The base64 encoded image
language:
type: string
description: ISO 639-2 language code of the icon
@@ -126,15 +126,5 @@ properties:
- width: 32
height: 32
type: image/png
uri: http://example.org/operator-32x32.png
language: eng
- width: 64
height: 64
type: image/png
uri: http://example.org/operator-64x64.png
language: eng
- width: 16
height: 16
type: image/gif
uri: data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7
language: eng
icon: R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7

View File

@@ -2676,8 +2676,19 @@ function instantiateInterfaceSsidPassPoint(location, value, errors) {
}
function parseAnqp3gppCellNet(location, value, errors) {
if (type(value) != "string")
push(errors, [ location, "must be of type string" ]);
if (type(value) == "array") {
function parseItem(location, value, errors) {
if (type(value) != "string")
push(errors, [ location, "must be of type string" ]);
return value;
}
return map(value, (item, i) => parseItem(location + "/" + i, item, errors));
}
if (type(value) != "array")
push(errors, [ location, "must be of type array" ]);
return value;
}
@@ -2708,7 +2719,7 @@ function instantiateInterfaceSsidPassPoint(location, value, errors) {
obj.friendly_name = parseFriendlyName(location + "/friendly-name", value["friendly-name"], errors);
}
function parseIcon(location, value, errors) {
function parseIcons(location, value, errors) {
if (type(value) == "array") {
function parseItem(location, value, errors) {
if (type(value) == "object") {
@@ -2747,10 +2758,10 @@ function instantiateInterfaceSsidPassPoint(location, value, errors) {
obj.type = parseType(location + "/type", value["type"], errors);
}
function parseUri(location, value, errors) {
function parseIcon(location, value, errors) {
if (type(value) == "string") {
if (!matchUri(value))
push(errors, [ location, "must be a valid URI" ]);
if (!matchUcBase64(value))
push(errors, [ location, "must be a valid base64 encoded data" ]);
}
@@ -2760,8 +2771,8 @@ function instantiateInterfaceSsidPassPoint(location, value, errors) {
return value;
}
if (exists(value, "uri")) {
obj.uri = parseUri(location + "/uri", value["uri"], errors);
if (exists(value, "icon")) {
obj.icon = parseIcon(location + "/icon", value["icon"], errors);
}
function parseLanguage(location, value, errors) {
@@ -2799,8 +2810,8 @@ function instantiateInterfaceSsidPassPoint(location, value, errors) {
return value;
}
if (exists(value, "icon")) {
obj.icon = parseIcon(location + "/icon", value["icon"], errors);
if (exists(value, "icons")) {
obj.icons = parseIcons(location + "/icons", value["icons"], errors);
}
return obj;

View File

@@ -1027,7 +1027,10 @@
"minimum": 0
},
"anqp-3gpp-cell-net": {
"type": "string"
"type": "array",
"items": {
"type": "string"
}
},
"friendly-name": {
"type": "array",
@@ -1035,7 +1038,7 @@
"type": "string"
}
},
"icon": {
"icons": {
"type": "array",
"items": {
"type": "object",
@@ -1058,12 +1061,9 @@
"image/png"
]
},
"uri": {
"icon": {
"type": "string",
"format": "uri",
"examples": [
"http://example.org/operator-64x64.png"
]
"format": "uc-base64"
},
"language": {
"type": "string",
@@ -1081,22 +1081,8 @@
"width": 32,
"height": 32,
"type": "image/png",
"uri": "http://example.org/operator-32x32.png",
"language": "eng"
},
{
"width": 64,
"height": 64,
"type": "image/png",
"uri": "http://example.org/operator-64x64.png",
"language": "eng"
},
{
"width": 16,
"height": 16,
"type": "image/gif",
"uri": "data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7",
"language": "eng"
"language": "eng",
"icon": "R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7"
}
]
}