Coder Social home page Coder Social logo

supl's Introduction

= What this is about =

This is an implementation of OMA SUPL and 3GPP RRLP protocols used in
Assisted GPS (AGPS). Only client (mobile) initiated case is implemented.

The package provides 2 user level executables

1) supl-client and
2) supl-proxy

and supporting SUPL/RRLP library libsupl.


== supl-client ==

supl-client connect to a SUPL server over the Internet and gets GPS
assistance (A-GPS) data, like satellite ephemeris and almanac data
from it. The received data can then be fed to a GPS receiver (assuming
the receiver accepts such data) to speed up satellite acquistion.

Usage:
supl-client options [supl-server]
Options:
  --cell gsm:mcc,mns:lac,ci|wcdma:mcc,msn,uc	set current gsm/wcdma cell id
  --cell gsm:mcc,mns:lac,ci:lat,lon,uncert	set known gsm cell id with position
  --format human				machine parseable output
  --debug n					1 == RRLP, 2 == SUPL, 4 == DEBUG
  --debug-file file				write debug to file
  --help                                        show this help
Example:
supl-client --cell=gsm:244,5:0x59e2,0x31b0:60.169995,24.939995,127 --cell=gsm:244,5:0x59e2,0x31b0

The default SUPL server is supl.google.com.

Supl server may not return all assistance information if --gsm-cell
is not given. You can give some cell id to supl server but position
information returned by the server (based on the cell id) can be
overridden by --set-pos in the output. Format for this is 

--set-pos=lat,lon,uncertainty

where both lat and lon are decimal degrees (N and E positive) and
uncertainty in meters.

Also if environment variable SUPL_FAKE_POS it is used as the
position estimate coming from the supl server. Format is the same
as in --set-pos.

With test options '-t 0', '-t 1' or '-t 2' you  get a quick feeling
how and if things will work - if they work ;-)


== supl-proxy ==

Usage:
supl-proxy supl-server

Sets up a proxy and displays SUPL / RRLP traffic between the client
and server. Convenient for debugging and figuring out the protocol.

To use it, you must direct your mobile to use your proxy server as its
SUPL server. In Nokia N95 this is in Tool -> Settings -> General ->
Positioning -> Positioning server. In Nokia N900 such setting is also
available in the settings application.

You must also install a SSL root certificate to the phone. The root
certificate must be set as trusted certificate in the phone. In N95
just set all uses as trusted (in the certificate manager). In N900 you
must use command line tool cmcli (available in maemosec-certman-tools
package) and install the root certificate into common-ca domain.

The proxy server must be given a server certificate (signed by the
root certificate) and private key. The proxy reads them from
cert/srv-{cert,priv}.pem files.

=== How to generate keys and certificates ===

** You can skip this section if you do not use supl-proxy **

All SSL keys and certificates can be generated with supl-cert tool if
you do not have those around already.

Run supl-cert with your proxy server domain name as the only argument:

~/src/supl-1.0 $ supl-cert proxy.dot.com

It will create CA certificate and private key files ca-cert.pem and
ca-priv.pem, and proxy server certificate (signed by the CA) and
server private key files srv-cert.pem and srv-priv.pem.

File ca-cert.pem should be sent (e.g. OBEX push for N95 or simple copy
for N900) to your mobile and then installed into certificate
store. Make sure to give it SSL trust.

supl-proxy expects to find srv-cert.pem and src-priv.pem from the
current directory. CA private key ca-priv.pem is not needed anymore.

= Compiling =

== Compile without ASN.1 compiler ==

If you do not have asn1c (http://lionet.info/asn1c) available do:

~/src/supl $ ./configure --precompiled-asn1
~/src/supl $ make
~/src/supl $ sudo make install

That's it.


== Compile with ASN.1 compiler  ==

You should use asn1c version 0.9.23, there are some issues with
earlier versions.

Get the asn1c source from http://lionet.info/asn1c/download.html or
clone the git repository

~src/ $ git clone git://github.com/vlm/asn1c.git

and then configure, compile and install it first:

~/src/ $ cd asn1c
~/src/asn1c $ make
~/src/asn1c $ sudo make install

You may want get rid of your distribution provided asn1c compiler
first, or at least make sure the following compilation uses this newer
version.

Then proceed with compiling this stuff

~/src/supl $ ./configure
~/src/supl $ make
~/src/supl $ sudo make install


== Fixing ASN specs ==

There is a conflict with NavigationModel which is defined by both supl
and rrlp. Rename definition and every reference to NavigationModel
with XNavigationModel in src/supl-posinit.asn.


== ASN.1 compilation from sources ==

Generation of compiled C-files from ASN.1 sources should happen
automatically with make. But if you add new ASN.1 files or PDUs you
must check and modify the Makefile in src/asn-rrlp or src/asn-supl
directory to include any new structures you introduced into ASN files.

You can give path to asn1c skeleton files to configure script as

~/src/supl $ ./configure --asn1c-skeletons /path/to/asn1c-git-HEAD


== Getting MCC, MNC, LAC and CI ==

You need to provide your position estimate to supl server as
cellular transmitter tower ids. One way to get them is to
go to the AT-command interpreter in your phone and ask for them:

at+cops?
+COPS: 0,2,"24405",2
OK
at+creg=2
OK
at+creg?
+CREG: 2,1,"59E2","31B0"
OK
at+creg=0
OK

==> you get needed values

MCC = 244
MCN = 05
LAC = 0x59e2
CI = 0x31b0


Alternatively you may setup supl-proxy on your machine and see
what your device talks to the supl server.

supl's People

Contributors

buzztiaan avatar tajuma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

supl's Issues

Compile Error

I get an error when trying to compile from source. It seems like the compiler is not generating the ENUMERATED.o file in the asn-supl directory. Here are the steps I took:

Steps to reproduce

./configure --enable-debug --enable-supl-debug
make

Expected
supl-client compiles

Actual
Error:

make[3]: *** No rule to make target 'ENUMERATED.o', needed by 'libasnsupl.a'.  Stop.

Environment
box: Ubuntu 16.04.6 LTS
asn1c: v0.9.27 (also tried on v0.9.28 and latest master)

I know I can configure with the --precompiled-asn1 option, but I'm trying to debug my SUPL connection and I believe that the precompiled doesn't include debugging? The reason being is a simple test like supl-client -t 3 <supl url> produces SUPL protocol error -1. This could happen for several reasons, which is why I would like the debugging statements.

SSL problem

Good afternoon. I managed to build everything from source, but every time I try to start the proxy, I get an error
Error: Valid server certificate not found in srv-cert.pem

OpenSSl veriosn 1.1.1f
ubuntu 22.04

Server always returning -2

Hey, I've compiled and run the program with no errors, but the program seems to always returning -2.
This is the setups I have tried so far:
I've set up a currect location with the SUPL_FAKE_POS env, and took the mcc,mnc,lat,cid from my modem which still returned -2.
I tried to play with the configuration in your example which result with the same "SUPL protocol error -2"

It seems that the problem is in supl_ulp_encode fucntion at the supl.c file.
the function at uper_encode_to_buffer returns -1. which in the end result in E_SUPL_ENCODE_START
(which is the -2 error)

IPV6 support

How to enable IPV6 support. supl server listen on ipv6.

always SUPL protocol error -2

Seems asn1 parser fails on ulp start but I can not understand what error is . Could you please assist?

Host info:

user@host:/work/temp/supl/src$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.1 LTS
Release: 22.04
Codename: jammy
user@host:
/work/temp/supl/src$ uname -a
Linux vs-lenovo-t15 5.19.0-38-generic #39~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 17 21:16:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Problem log:

$ LD_LIBRARY_PATH=$PWD ./supl-client -t 3
uper_encode_to_buffer
Encoding "ULP-PDU" using UNALIGNED PER (per_encoder.c:40)
Encoding ULP-PDU as SEQUENCE (UPER) (constr_SEQUENCE.c:1312)
ext_after = -1, ec = 4, eb = -1 (constr_SEQUENCE.c:1362)
About to encode INTEGER (constr_SEQUENCE.c:1373)
Encoding ULP-PDU->length (constr_SEQUENCE.c:1395)
Encoding NativeInteger INTEGER 0 (UPER) (NativeInteger.c:282)
Value 0 (00/1) lb 0 ub 65535 fix (INTEGER.c:712)
Encoding integer with range 16 bits (INTEGER.c:730)
[PER put 16 bits 0 to 0x7ffee6430668+0 bits] (per_support.c:277)
[PER out 16 0/0 (t=0,o=16) 90&0=0] (per_support.c:315)
[PER out 0/0 => 00 buf+0] (per_support.c:344)
Freeing INTEGER as a primitive type (asn_codecs_prim.c:125)
About to encode Version (constr_SEQUENCE.c:1373)
Encoding ULP-PDU->version (constr_SEQUENCE.c:1395)
Encoding Version as SEQUENCE (UPER) (constr_SEQUENCE.c:1312)
ext_after = -1, ec = 3, eb = -1 (constr_SEQUENCE.c:1362)
About to encode INTEGER (constr_SEQUENCE.c:1373)
Encoding Version->maj (constr_SEQUENCE.c:1395)
Encoding NativeInteger INTEGER 1 (UPER) (NativeInteger.c:282)
Value 1 (01/1) lb 0 ub 255 fix (INTEGER.c:712)
Encoding integer with range 8 bits (INTEGER.c:730)
[PER put 8 bits 1 to 0x7ffee6430668+16 bits] (per_support.c:277)
[PER out 8 1/1 (t=0,o=8) 5c&0=0] (per_support.c:315)
[PER out 1/1 => 01 buf+2] (per_support.c:344)
Freeing INTEGER as a primitive type (asn_codecs_prim.c:125)
About to encode INTEGER (constr_SEQUENCE.c:1373)
Encoding Version->min (constr_SEQUENCE.c:1395)
Encoding NativeInteger INTEGER 0 (UPER) (NativeInteger.c:282)
Value 0 (00/1) lb 0 ub 255 fix (INTEGER.c:712)
Encoding integer with range 8 bits (INTEGER.c:730)
[PER put 8 bits 0 to 0x7ffee643066a+8 bits] (per_support.c:277)
[PER out 8 0/0 (t=0,o=8) dd&0=0] (per_support.c:315)
[PER out 0/0 => 00 buf+3] (per_support.c:344)
Freeing INTEGER as a primitive type (asn_codecs_prim.c:125)
About to encode INTEGER (constr_SEQUENCE.c:1373)
Encoding Version->servind (constr_SEQUENCE.c:1395)
Encoding NativeInteger INTEGER 0 (UPER) (NativeInteger.c:282)
Value 0 (00/1) lb 0 ub 255 fix (INTEGER.c:712)
Encoding integer with range 8 bits (INTEGER.c:730)
[PER put 8 bits 0 to 0x7ffee643066b+8 bits] (per_support.c:277)
[PER out 8 0/0 (t=0,o=8) ef&0=0] (per_support.c:315)
[PER out 0/0 => 00 buf+4] (per_support.c:344)
Freeing INTEGER as a primitive type (asn_codecs_prim.c:125)
About to encode SessionID (constr_SEQUENCE.c:1373)
Encoding ULP-PDU->sessionID (constr_SEQUENCE.c:1395)
Encoding SessionID as SEQUENCE (UPER) (constr_SEQUENCE.c:1312)
Element ptr wtv SessionID->setSessionID is present (constr_SEQUENCE.c:1351)
[PER put 1 bits 1 to 0x7ffee643066c+8 bits] (per_support.c:277)
[PER out 1 1/1 (t=0,o=1) 7f&0=0] (per_support.c:315)
[PER out 128/80 => 80 buf+5] (per_support.c:344)
Element ptr wtv SessionID->slpSessionID is absent (constr_SEQUENCE.c:1351)
[PER put 1 bits 0 to 0x7ffee643066d+1 bits] (per_support.c:277)
[PER out 1 0/0 (t=1,o=2) 80&80=80] (per_support.c:315)
[PER out 0/0 => 80 buf+5] (per_support.c:344)
ext_after = -1, ec = 2, eb = -1 (constr_SEQUENCE.c:1362)
About to encode SetSessionID (constr_SEQUENCE.c:1373)
Encoding SessionID->setSessionID (constr_SEQUENCE.c:1395)
Encoding SetSessionID as SEQUENCE (UPER) (constr_SEQUENCE.c:1312)
ext_after = -1, ec = 2, eb = -1 (constr_SEQUENCE.c:1362)
About to encode INTEGER (constr_SEQUENCE.c:1373)
Encoding SetSessionID->sessionId (constr_SEQUENCE.c:1395)
Encoding NativeInteger INTEGER 1 (UPER) (NativeInteger.c:282)
Value 1 (01/1) lb 0 ub 65535 fix (INTEGER.c:712)
Encoding integer with range 16 bits (INTEGER.c:730)
[PER put 16 bits 1 to 0x7ffee643066d+2 bits] (per_support.c:277)
[PER out 16 1/1 (t=2,o=18) 80&c0=80] (per_support.c:315)
[PER out 64/40 => 80 buf+5] (per_support.c:344)
Freeing INTEGER as a primitive type (asn_codecs_prim.c:125)
About to encode SETId (constr_SEQUENCE.c:1373)
Encoding SetSessionID->setId (constr_SEQUENCE.c:1395)
Encoding SETId as CHOICE (constr_CHOICE.c:919)
Encoding SETId CHOICE element 3 (constr_CHOICE.c:941)
[PER put 1 bits 0 to 0x7ffee643066d+18 bits] (per_support.c:277)
[PER out 1 0/0 (t=2,o=3) 40&c0=40] (per_support.c:315)
[PER out 0/0 => 40 buf+7] (per_support.c:344)
[PER put 3 bits 3 to 0x7ffee643066f+3 bits] (per_support.c:277)
[PER out 3 3/3 (t=3,o=6) 40&e0=40] (per_support.c:315)
[PER out 12/c => 4c buf+7] (per_support.c:344)
Encoding OCTET STRING into 8 units of 8 bits (8..8, effective 0) (OCTET_STRING.c:1568)
Encoding 8 bytes (0), length in 0 bits (OCTET_STRING.c:1601)
Squeezing 8 characters into (0..0):8 (1 bpc) (OCTET_STRING.c:1264)
[PER put 24 bits ffff91 to 0x7ffee643066f+6 bits] (per_support.c:277)
[PER out 24 16777105/ffff91 (t=6,o=30) 4c&fc=4c] (per_support.c:315)
[PER out 67108420/3fffe44 => 4f buf+7] (per_support.c:344)
[PER put 24 bits 944845 to 0x7ffee643066f+30 bits] (per_support.c:277)
[PER out 24 9717829/944845 (t=6,o=30) 44&fc=44] (per_support.c:315)
[PER out 38871316/2512114 => 46 buf+10] (per_support.c:344)
[PER put 16 bits 8398 to 0x7ffee6430672+30 bits] (per_support.c:277)
[PER out 16 33688/8398 (t=6,o=22) 14&fc=14] (per_support.c:315)
[PER out 134752/20e60 => 16 buf+13] (per_support.c:344)
About to encode SlpSessionID (constr_SEQUENCE.c:1373)
Element slpSessionID 1 not present (constr_SEQUENCE.c:1379)
About to encode UlpMessage (constr_SEQUENCE.c:1373)
Encoding ULP-PDU->message (constr_SEQUENCE.c:1395)
Encoding UlpMessage as CHOICE (constr_CHOICE.c:919)
Encoding UlpMessage CHOICE element 1 (constr_CHOICE.c:941)
[PER put 1 bits 0 to 0x7ffee6430675+22 bits] (per_support.c:277)
[PER out 1 0/0 (t=6,o=7) 60&fc=60] (per_support.c:315)
[PER out 0/0 => 60 buf+15] (per_support.c:344)
[PER put 3 bits 1 to 0x7ffee6430677+7 bits] (per_support.c:277)
[PER out 3 1/1 (t=7,o=10) 60&fe=60] (per_support.c:315)
[PER out 64/40 => 60 buf+15] (per_support.c:344)
Encoding SUPLSTART as SEQUENCE (UPER) (constr_SEQUENCE.c:1312)
[PER put 1 bits 0 to 0x7ffee6430677+10 bits] (per_support.c:277)
[PER out 1 0/0 (t=2,o=3) 40&c0=40] (per_support.c:315)
[PER out 0/0 => 40 buf+16] (per_support.c:344)
Element ptr wtv SUPLSTART->qoP is absent (constr_SEQUENCE.c:1351)
[PER put 1 bits 0 to 0x7ffee6430678+3 bits] (per_support.c:277)
[PER out 1 0/0 (t=3,o=4) 40&e0=40] (per_support.c:315)
[PER out 0/0 => 40 buf+16] (per_support.c:344)
ext_after = 2, ec = 3, eb = 4 (constr_SEQUENCE.c:1362)
About to encode SETCapabilities (constr_SEQUENCE.c:1373)
Encoding SUPLSTART->sETCapabilities (constr_SEQUENCE.c:1395)
Encoding SETCapabilities as SEQUENCE (UPER) (constr_SEQUENCE.c:1312)
[PER put 1 bits 0 to 0x7ffee6430678+4 bits] (per_support.c:277)
[PER out 1 0/0 (t=4,o=5) 40&f0=40] (per_support.c:315)
[PER out 0/0 => 40 buf+16] (per_support.c:344)
ext_after = 2, ec = 3, eb = 4 (constr_SEQUENCE.c:1362)
About to encode PosTechnology (constr_SEQUENCE.c:1373)
Encoding SETCapabilities->posTechnology (constr_SEQUENCE.c:1395)
Encoding PosTechnology as SEQUENCE (UPER) (constr_SEQUENCE.c:1312)
[PER put 1 bits 0 to 0x7ffee6430678+5 bits] (per_support.c:277)
[PER out 1 0/0 (t=5,o=6) 40&f8=40] (per_support.c:315)
[PER out 0/0 => 40 buf+16] (per_support.c:344)
ext_after = 6, ec = 7, eb = 8 (constr_SEQUENCE.c:1362)
About to encode BOOLEAN (constr_SEQUENCE.c:1373)
Encoding PosTechnology->agpsSETassisted (constr_SEQUENCE.c:1395)
[PER put 1 bits 0 to 0x7ffee6430678+6 bits] (per_support.c:277)
[PER out 1 0/0 (t=6,o=7) 40&fc=40] (per_support.c:315)
[PER out 0/0 => 40 buf+16] (per_support.c:344)
uper_encode_internal -1
Failed to encode element ULP-PDU (per_encoder.c:153)
Freeing ULP-PDU as SEQUENCE (constr_SEQUENCE.c:958)
Freeing INTEGER as INTEGER (1, 0x5568a213f400, Native) (NativeInteger.c:325)
Freeing Version as SEQUENCE (constr_SEQUENCE.c:958)
Freeing INTEGER as INTEGER (1, 0x5568a213f408, Native) (NativeInteger.c:325)
Freeing INTEGER as INTEGER (1, 0x5568a213f410, Native) (NativeInteger.c:325)
Freeing INTEGER as INTEGER (1, 0x5568a213f418, Native) (NativeInteger.c:325)
Freeing SessionID as SEQUENCE (constr_SEQUENCE.c:958)
Freeing SetSessionID as SEQUENCE (constr_SEQUENCE.c:958)
Freeing INTEGER as INTEGER (1, 0x5568a213f600, Native) (NativeInteger.c:325)
Freeing SETId as CHOICE (constr_CHOICE.c:1038)
Freeing OCTET STRING as OCTET STRING (OCTET_STRING.c:1725)
Freeing UlpMessage as CHOICE (constr_CHOICE.c:1038)
Freeing SUPLSTART as SEQUENCE (constr_SEQUENCE.c:958)
Freeing SETCapabilities as SEQUENCE (constr_SEQUENCE.c:958)
Freeing PosTechnology as SEQUENCE (constr_SEQUENCE.c:958)
Freeing PrefMethod as a primitive type (asn_codecs_prim.c:125)
Freeing PosProtocol as SEQUENCE (constr_SEQUENCE.c:958)
Freeing LocationId as SEQUENCE (constr_SEQUENCE.c:958)
Freeing CellInfo as CHOICE (constr_CHOICE.c:1038)
Freeing WcdmaCellInformation as SEQUENCE (constr_SEQUENCE.c:958)
Freeing INTEGER as INTEGER (1, 0x5568a213f4f8, Native) (NativeInteger.c:325)
Freeing INTEGER as INTEGER (1, 0x5568a213f500, Native) (NativeInteger.c:325)
Freeing INTEGER as INTEGER (1, 0x5568a213f508, Native) (NativeInteger.c:325)
Freeing Status as a primitive type (asn_codecs_prim.c:125)
SUPL protocol error -2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.