Subversion Repositories HelenOS-historic

Rev

Rev 1336 | Rev 1343 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1336 Rev 1338
Line 101... Line 101...
101
    ipc_callid_t callid;
101
    ipc_callid_t callid;
102
    char *as;
102
    char *as;
103
   
103
   
104
    ipcarg_t retval, arg1, arg2;
104
    ipcarg_t retval, arg1, arg2;
105
 
105
 
106
    printf("%s: Name service started.\n", NAME);
106
    printf("%s: Naming service started.\n", NAME);
107
   
107
   
108
    if (!hash_table_create(&ns_hash_table, NS_HASH_TABLE_CHAINS, 3, &ns_hash_table_ops)) {
108
    if (!hash_table_create(&ns_hash_table, NS_HASH_TABLE_CHAINS, 3, &ns_hash_table_ops)) {
109
        printf("%s: cannot create hash table\n", NAME);
109
        printf("%s: cannot create hash table\n", NAME);
110
        return ENOMEM;
110
        return ENOMEM;
111
    }
111
    }
Line 146... Line 146...
146
            /*
146
            /*
147
             * Client requests to be connected to a service.
147
             * Client requests to be connected to a service.
148
             */
148
             */
149
            retval = connect_to_service(IPC_GET_ARG1(call), &call, callid);
149
            retval = connect_to_service(IPC_GET_ARG1(call), &call, callid);
150
            break;
150
            break;
-
 
151
        case NS_HANGUP:
-
 
152
            printf("Closing connection.\n");
-
 
153
            retval = EHANGUP;
-
 
154
            break;
151
        case NS_PING:
155
        case NS_PING:
152
            printf("Ping...%P %P\n", IPC_GET_ARG1(call),
156
            printf("Ping...%P %P\n", IPC_GET_ARG1(call),
153
                   IPC_GET_ARG2(call));
157
                   IPC_GET_ARG2(call));
154
            retval = 0;
158
            retval = 0;
155
            arg1 = 0xdead;
159
            arg1 = 0xdead;
156
            arg2 = 0xbeef;
160
            arg2 = 0xbeef;
157
            break;
161
            break;
158
        case NS_HANGUP:
-
 
159
            printf("Closing connection.\n");
-
 
160
            retval = EHANGUP;
-
 
161
            break;
-
 
162
        case NS_PING_SVC:
162
        case NS_PING_SVC:
163
            printf("NS:Pinging service %d\n", ping_phone);
163
            printf("NS:Pinging service %d\n", ping_phone);
164
            ipc_call_sync(ping_phone, NS_PING, 0xbeef, 0);
164
            ipc_call_sync(ping_phone, NS_PING, 0xbeef, 0);
165
            printf("NS:Got pong\n");
165
            printf("NS:Got pong\n");
166
            break;
166
            break;
Line 174... Line 174...
174
            ipc_answer(callid, retval, arg1, arg2);
174
            ipc_answer(callid, retval, arg1, arg2);
175
        }
175
        }
176
    }
176
    }
177
}
177
}
178
 
178
 
179
/** Register server.
179
/** Register service.
180
 *
180
 *
181
 * @param service Service to be registered.
181
 * @param service Service to be registered.
182
 * @param phone phone Phone to be used for connections to the service.
182
 * @param phone phone Phone to be used for connections to the service.
183
 * @param call Pointer to call structure.
183
 * @param call Pointer to call structure.
184
 *
184
 *
Line 225... Line 225...
225
    link_t *hlp;
225
    link_t *hlp;
226
    hashed_service_t *hs;
226
    hashed_service_t *hs;
227
           
227
           
228
    hlp = hash_table_find(&ns_hash_table, keys);
228
    hlp = hash_table_find(&ns_hash_table, keys);
229
    if (!hlp) {
229
    if (!hlp) {
230
        printf("Service %d noty registered.\n", service);
230
        printf("Service %d not registered.\n", service);
231
        return ENOENT;
231
        return ENOENT;
232
    }
232
    }
233
    hs = hash_table_get_instance(hlp, hashed_service_t, link);
233
    hs = hash_table_get_instance(hlp, hashed_service_t, link);
234
    printf("Connecting in_phone_hash=%lX to service at phone %d...", call->in_phone_hash, hs->phone);
234
    printf("Connecting in_phone_hash=%lX to service at phone %d...", call->in_phone_hash, hs->phone);
235
    return ipc_forward_fast(callid, hs->phone, 0, 0);
235
    return ipc_forward_fast(callid, hs->phone, 0, 0);