~martin-decky/helenos/rcu

« back to all changes in this revision

Viewing changes to uspace/lib/c/generic/ns.c

get rid of net/modules.{c|h}

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#include <ipc/ns.h>
37
37
#include <async.h>
38
38
#include <macros.h>
 
39
#include <errno.h>
39
40
#include "private/ns.h"
40
41
 
41
42
int service_register(sysarg_t service)
47
48
        return rc;
48
49
}
49
50
 
50
 
async_sess_t *service_connect(exch_mgmt_t mgmt, sysarg_t service, sysarg_t arg2,
 
51
async_sess_t *service_connect(exch_mgmt_t mgmt, services_t service, sysarg_t arg2,
51
52
    sysarg_t arg3)
52
53
{
53
54
        async_exch_t *exch = async_exchange_begin(session_ns);
71
72
        return sess;
72
73
}
73
74
 
74
 
async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, sysarg_t service,
 
75
async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, services_t service,
75
76
    sysarg_t arg2, sysarg_t arg3)
76
77
{
77
78
        async_exch_t *exch = async_exchange_begin(session_ns);
80
81
        async_sess_t *sess =
81
82
            async_connect_me_to_blocking(mgmt, exch, service, arg2, arg3);
82
83
        async_exchange_end(exch);
83
 
 
 
84
        
84
85
        if (!sess)
85
86
                return NULL;
86
87
        
94
95
        return sess;
95
96
}
96
97
 
 
98
/** Create bidirectional connection with a service
 
99
 *
 
100
 * @param[in] service         Service.
 
101
 * @param[in] arg1            First parameter.
 
102
 * @param[in] arg2            Second parameter.
 
103
 * @param[in] arg3            Third parameter.
 
104
 * @param[in] client_receiver Message receiver.
 
105
 *
 
106
 * @return Session to the service.
 
107
 * @return Other error codes as defined by async_connect_to_me().
 
108
 *
 
109
 */
 
110
async_sess_t *service_bind(services_t service, sysarg_t arg1, sysarg_t arg2,
 
111
    sysarg_t arg3, async_client_conn_t client_receiver)
 
112
{
 
113
        /* Connect to the needed service */
 
114
        async_sess_t *sess =
 
115
            service_connect_blocking(EXCHANGE_SERIALIZE, service, 0, 0);
 
116
        if (sess != NULL) {
 
117
                /* Request callback connection */
 
118
                async_exch_t *exch = async_exchange_begin(sess);
 
119
                int rc = async_connect_to_me(exch, arg1, arg2, arg3,
 
120
                    client_receiver, NULL);
 
121
                async_exchange_end(exch);
 
122
                
 
123
                if (rc != EOK) {
 
124
                        async_hangup(sess);
 
125
                        errno = rc;
 
126
                        return NULL;
 
127
                }
 
128
        }
 
129
        
 
130
        return sess;
 
131
}
 
132
 
97
133
int ns_ping(void)
98
134
{
99
135
        async_exch_t *exch = async_exchange_begin(session_ns);