Changeset 14f1db0 in mainline for uspace/lib/socket/include
- Timestamp:
- 2010-04-09T12:54:57Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a1caa3c2
- Parents:
- 24ab58b3
- Location:
- uspace/lib/socket/include
- Files:
-
- 3 edited
-
net_messages.h (modified) (2 diffs)
-
net_modules.h (modified) (1 diff)
-
packet/packet_client.h (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/socket/include/net_messages.h
r24ab58b3 r14f1db0 462 462 /*@}*/ 463 463 464 /** Notifies the module about the device state change. 465 * @param[in] phone The service module phone. 466 * @param[in] message The service specific message. 467 * @param[in] device_id The device identifier. 468 * @param[in] state The new device state. 469 * @param[in] target The target module service. 470 * @returns EOK on success. 471 */ 472 static inline int generic_device_state_msg(int phone, int message, device_id_t device_id, int state, services_t target){ 473 async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) state, target); 464 /** Notify the module about the device state change. 465 * 466 * @param[in] phone The service module phone. 467 * @param[in] message The service specific message. 468 * @param[in] device_id The device identifier. 469 * @param[in] state The new device state. 470 * @param[in] target The target module service. 471 * 472 * @return EOK on success. 473 * 474 */ 475 static inline int generic_device_state_msg_remote(int phone, int message, 476 device_id_t device_id, int state, services_t target) 477 { 478 async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, 479 (ipcarg_t) state, target); 480 474 481 return EOK; 475 482 } 476 483 477 /** Notifies a module about the device. 478 * @param[in] phone The service module phone. 479 * @param[in] message The service specific message. 480 * @param[in] device_id The device identifier. 481 * @param[in] arg2 The second argument of the message. 482 * @param[in] service The device module service. 483 * @returns EOK on success. 484 * @returns Other error codes as defined for the specific service message. 485 */ 486 static inline int generic_device_req(int phone, int message, device_id_t device_id, int arg2, services_t service){ 487 return (int) async_req_3_0(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) arg2, (ipcarg_t) service); 484 /** Notify a module about the device. 485 * 486 * @param[in] phone The service module phone. 487 * @param[in] message The service specific message. 488 * @param[in] device_id The device identifier. 489 * @param[in] arg2 The second argument of the message. 490 * @param[in] service The device module service. 491 * 492 * @return EOK on success. 493 * @return Other error codes as defined for the specific service message. 494 * 495 */ 496 static inline int generic_device_req_remote(int phone, int message, 497 device_id_t device_id, int arg2, services_t service) 498 { 499 return (int) async_req_3_0(phone, (ipcarg_t) message, (ipcarg_t) device_id, 500 (ipcarg_t) arg2, (ipcarg_t) service); 488 501 } 489 502 … … 521 534 } 522 535 523 /** Returns the device packet dimension for sending. 524 * @param[in] phone The service module phone. 525 * @param[in] message The service specific message. 526 * @param[in] device_id The device identifier. 527 * @param[out] packet_dimension The packet dimension. 528 * @returns EOK on success. 529 * @returns EBADMEM if the packet_dimension parameter is NULL. 530 * @returns Other error codes as defined for the specific service message. 531 */ 532 static inline int generic_packet_size_req(int phone, int message, device_id_t device_id, packet_dimension_ref packet_dimension){ 533 ipcarg_t result; 536 /** Return the device packet dimension for sending. 537 * 538 * @param[in] phone The service module phone. 539 * @param[in] message The service specific message. 540 * @param[in] device_id The device identifier. 541 * @param[out] packet_dimension The packet dimension. 542 * 543 * @return EOK on success. 544 * @return EBADMEM if the packet_dimension parameter is NULL. 545 * @return Other error codes as defined for the specific service message. 546 * 547 */ 548 static inline int generic_packet_size_req_remote(int phone, int message, 549 device_id_t device_id, packet_dimension_ref packet_dimension) 550 { 551 if (!packet_dimension) 552 return EBADMEM; 553 554 ipcarg_t addr_len; 534 555 ipcarg_t prefix; 535 556 ipcarg_t content; 536 557 ipcarg_t suffix; 537 ipcarg_t addr_len; 538 539 if(! packet_dimension){ 540 return EBADMEM; 541 } 542 result = async_req_1_4(phone, (ipcarg_t) message, (ipcarg_t) device_id, &addr_len, &prefix, &content, &suffix); 558 559 ipcarg_t result = async_req_1_4(phone, (ipcarg_t) message, 560 (ipcarg_t) device_id, &addr_len, &prefix, &content, &suffix); 561 543 562 packet_dimension->prefix = (size_t) prefix; 544 563 packet_dimension->content = (size_t) content; 545 564 packet_dimension->suffix = (size_t) suffix; 546 565 packet_dimension->addr_len = (size_t) addr_len; 566 547 567 return (int) result; 548 568 } 549 569 550 /** Passes the packet queue to the module. 551 * @param[in] phone The service module phone. 552 * @param[in] message The service specific message. 553 * @param[in] device_id The device identifier. 554 * @param[in] packet_id The received packet or the received packet queue identifier. 555 * @param[in] target The target module service. 556 * @param[in] error The error module service. 557 * @returns EOK on success. 558 */ 559 static inline int generic_received_msg(int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t target, services_t error){ 560 if(error){ 561 async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) packet_id, (ipcarg_t) target, (ipcarg_t) error); 562 }else{ 563 async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) packet_id, (ipcarg_t) target); 564 } 570 /** Pass the packet queue to the module. 571 * 572 * @param[in] phone The service module phone. 573 * @param[in] message The service specific message. 574 * @param[in] device_id The device identifier. 575 * @param[in] packet_id The received packet or the received packet queue 576 * identifier. 577 * @param[in] target The target module service. 578 * @param[in] error The error module service. 579 * 580 * @return EOK on success. 581 * 582 */ 583 static inline int generic_received_msg_remote(int phone, int message, 584 device_id_t device_id, packet_id_t packet_id, services_t target, 585 services_t error) 586 { 587 if (error) 588 async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id, 589 (ipcarg_t) packet_id, (ipcarg_t) target, (ipcarg_t) error); 590 else 591 async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, 592 (ipcarg_t) packet_id, (ipcarg_t) target); 593 565 594 return EOK; 566 595 } 567 596 568 /** Sends the packet queue. 569 * @param[in] phone The service module phone. 570 * @param[in] message The service specific message. 571 * @param[in] device_id The device identifier. 572 * @param[in] packet_id The packet or the packet queue identifier. 573 * @param[in] sender The sending module service. 574 * @param[in] error The error module service. 575 * @returns EOK on success. 576 */ 577 static inline int generic_send_msg(int phone, int message, device_id_t device_id, packet_id_t packet_id, services_t sender, services_t error){ 578 if(error){ 579 async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) packet_id, (ipcarg_t) sender, (ipcarg_t) error); 580 }else{ 581 async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, (ipcarg_t) packet_id, (ipcarg_t) sender); 582 } 597 /** Send the packet queue. 598 * 599 * @param[in] phone The service module phone. 600 * @param[in] message The service specific message. 601 * @param[in] device_id The device identifier. 602 * @param[in] packet_id The packet or the packet queue identifier. 603 * @param[in] sender The sending module service. 604 * @param[in] error The error module service. 605 * 606 * @return EOK on success. 607 * 608 */ 609 static inline int generic_send_msg_remote(int phone, int message, 610 device_id_t device_id, packet_id_t packet_id, services_t sender, 611 services_t error) 612 { 613 if (error) 614 async_msg_4(phone, (ipcarg_t) message, (ipcarg_t) device_id, 615 (ipcarg_t) packet_id, (ipcarg_t) sender, (ipcarg_t) error); 616 else 617 async_msg_3(phone, (ipcarg_t) message, (ipcarg_t) device_id, 618 (ipcarg_t) packet_id, (ipcarg_t) sender); 619 583 620 return EOK; 584 621 } -
uspace/lib/socket/include/net_modules.h
r24ab58b3 r14f1db0 72 72 extern void answer_call(ipc_callid_t callid, int result, ipc_call_t * answer, int answer_count); 73 73 74 /** Creates bidirectional connection with the needed module service and registers the message receiver. 75 * @param[in] need The needed module service. 76 * @param[in] arg1 The first parameter. 77 * @param[in] arg2 The second parameter. 78 * @param[in] arg3 The third parameter. 79 * @param[in] client_receiver The message receiver. 80 * @returns The phone of the needed service. 81 * @returns Other error codes as defined for the ipc_connect_to_me() function. 82 */ 83 extern int bind_service(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver); 84 85 /** Creates bidirectional connection with the needed module service and registers the message receiver. 86 * @param[in] need The needed module service. 87 * @param[in] arg1 The first parameter. 88 * @param[in] arg2 The second parameter. 89 * @param[in] arg3 The third parameter. 90 * @param[in] client_receiver The message receiver. 91 * @param[in] timeout The connection timeout in microseconds. No timeout if set to zero (0). 92 * @returns The phone of the needed service. 93 * @returns ETIMEOUT if the connection timeouted. 94 * @returns Other error codes as defined for the ipc_connect_to_me() function. 95 */ 96 extern int bind_service_timeout(services_t need, ipcarg_t arg1, ipcarg_t arg2, ipcarg_t arg3, async_client_conn_t client_receiver, suseconds_t timeout); 74 extern int bind_service(services_t, ipcarg_t, ipcarg_t, ipcarg_t, 75 async_client_conn_t); 76 extern int bind_service_timeout(services_t, ipcarg_t, ipcarg_t, ipcarg_t, 77 async_client_conn_t, suseconds_t); 97 78 98 79 /** Connects to the needed module. -
uspace/lib/socket/include/packet/packet_client.h
r24ab58b3 r14f1db0 45 45 #define __NET_PACKET_CLIENT_H__ 46 46 47 #include "packet.h"47 #include <packet/packet.h> 48 48 49 49 /** @name Packet client interface … … 172 172 * @returns Other error codes as defined for the packet_return() function. 173 173 */ 174 extern int packet_translate (int phone, packet_ref packet, packet_id_t packet_id);174 extern int packet_translate_local(int phone, packet_ref packet, packet_id_t packet_id); 175 175 176 176 /** Obtains the packet of the given dimensions. … … 184 184 * @returns NULL on error. 185 185 */ 186 extern packet_t packet_get_4 (int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix);186 extern packet_t packet_get_4_local(int phone, size_t max_content, size_t addr_len, size_t max_prefix, size_t max_suffix); 187 187 188 188 /** Obtains the packet of the given content size. … … 193 193 * @returns NULL on error. 194 194 */ 195 extern packet_t packet_get_1 (int phone, size_t content);195 extern packet_t packet_get_1_local(int phone, size_t content); 196 196 197 197 /** Releases the packet queue. … … 202 202 * @param[in] packet_id The packet identifier. 203 203 */ 204 extern void pq_release (int phone, packet_id_t packet_id);204 extern void pq_release_local(int phone, packet_id_t packet_id); 205 205 206 206 /** Returns the packet copy.
Note:
See TracChangeset
for help on using the changeset viewer.
