aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/gprs/gprs_gsup_client.c
AgeCommit message (Collapse)AuthorFilesLines
2015-11-02gsup/oap: add OAP to GSUP client.Neels Hofmeyr1-6/+49
Trigger an OAP registration upon IPA connect. Feed incoming OAP messages to oap_handle() and send replies returned by it. Add oap_config to sgsn_config (todo: vty). Sponsored-by: On-Waves ehf [hfreyther: Fix coding style]
2015-10-07gsup: factor out header composition & sending.Neels Hofmeyr1-3/+9
Move IPA header composition and sending to new static gsup_client_send() (so I can use it in the upcoming OAP code). Sponsored-by: On-Waves ehf
2015-01-27gprs: Don't check for EINPROGRESS in gprs_gsup_client_createJacob Erlbeck1-1/+1
Currently, the return value of gsup_client_connect is checked whether it is < 0 and != -EINPROGESS. Since gsup_client_connect will only return a negative value on a few permanent errors (not including EINPROGRESS), rc is always != EINPROGRESS. This patch removes the explicit check againt -EINPROGRESS and just leaves the check rc < 0. Sponsored-by: On-Waves ehf
2015-01-26gprs: Return 0 from gsup_client_connect if ok or retry timer enabledJacob Erlbeck1-1/+4
Currently the gsup_client_connect return 0 if the call to ipa_client_conn_open was successful and -errno otherwise. This makes it difficult for the caller to determine, whether the the whole operation has been cancelled (currently on EBADF, ENOTSOCK, EAFNOSUPPORT, EINVAL) or whether the GSUP client will retry to connect after a timeout. This will cause gprs_gsup_client_create to destroy the GSUP client object, even if the error might be temporary. This patch changes the function to return 0 if (and only if) ipa_client_conn_open was successful or the retry timer has been started. Since the return value 0 doesn't guarantee, that a subsequent call to gprs_gsup_client_send will succeed, this shouldn't break anything. Sponsored-by: On-Waves ehf
2015-01-18gprs: Send PING and eventually reconnectJacob Erlbeck1-3/+58
Currently, the reconnect mechanism relies on gsup_client_updown_cb which in turn gets called based on the OS' view of connection state. This patch adds a timer based PING mechanism that regularly sends PING messages and forces a reconnect if a PONG message won't be received until the next PING message is scheduled. The current ping interval is 20s. Sponsored-by: On-Waves ehf Conflicts: openbsc/src/gprs/gprs_gsup_client.c [hfreyther: Conflicts due the potential memleak fix by me. Removed another TODO from the code as we stop the ping/pong timer]
2015-01-18gprs: Handle incoming IPA CCM message in gsup_client_read_cbJacob Erlbeck1-0/+25
Currently the IPA CCM messages are not handled by the GSUP client. This means, that the client doesn't answer to PING and ID_GET and logs notices when receiving PONG or ID_ACK. At least the PING functionality (remotely originated PING) shall be supported. This patch extends gsup_client_read_cb by a call to ipaccess_bts_handle_ccm. Only when the return code is 0, the message is processed further and checked for an OSMO/GSUP message. ID_GET messages are answered by a dummy description, where only the unit_name is set to 'SGSN'. Sponsored-by: On-Waves ehf
2015-01-18gprs: Handle return code of ipa_client_conn_open correctlyJacob Erlbeck1-3/+6
The ipa_client_conn_open function does not distinguish between a connection being already established or waiting for establishment. In either case, the application gets informed about the connection state via the updown_cb. The 'up' parameter is only set, if poll/select consider the socket as writable. This patch handles both cases equally and fully relies on the updown_cb to adjust the gsupc obejct state. Sponsored-by: On-Waves ehf
2015-01-18gprs: Avoid sending stale GSUP requests after reconnectJacob Erlbeck1-0/+8
Currently, messages are added to the tx queue even if the connection is down for some reason and all of these messages are eventually sent after a re-connect. The MS has probably sent several Attach Requests while the connection was down and will continue doing so. Therefore these stored messages could be dropped. This patch clears the queue before re-connecting and also extends gprs_gsup_client_send to return immediately, when the connection is not established instead of calling ipa_client_conn_send. Sponsored-by: On-Waves ehf [hfreyther: Replaced while (!llist_empty(&gsupc->link->tx_queue)) llist_del(gsupc->link->tx_queue.next); with new libosmo-abis API]
2015-01-18gprs: Add automatic re-connect if the GSUP connection is downJacob Erlbeck1-7/+69
Currently the GSUP connection to a server is not restarted if the connection cannot be established or is terminated during operation. This commit adds a timer based connection mechanism, basically consisting of a timer callback that calls gsup_client_connect. The timer is eventually triggered (up == 0) or cleared (up != 0) by gsup_client_updown_cb. It adds calls to osmo_timer_del() to gsup_client_connect and gprs_gsup_client_destroy. The latter is now called instead of talloc_free in gprs_gsup_client_create on error to be on the safe side. Sponsored-by: On-Waves ehf
2015-01-18gprs: Add GSUP clientJacob Erlbeck1-0/+132
This commit adds the client code to get subscriber information from a remote server. It provides an IPA over TCP connection to transmit and receive GSUP messages. Sponsored-by: On-Waves ehf