Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/socket/include/net_messages.h

    r14f1db0 r849ed54  
    462462/*@}*/
    463463
    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        
     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 */
     472static 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);
    481474        return EOK;
    482475}
    483476
    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);
     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 */
     486static 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);
    501488}
    502489
     
    534521}
    535522
    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;
     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 */
     532static inline int generic_packet_size_req(int phone, int message, device_id_t device_id, packet_dimension_ref packet_dimension){
     533        ipcarg_t result;
    555534        ipcarg_t prefix;
    556535        ipcarg_t content;
    557536        ipcarg_t 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        
     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);
    562543        packet_dimension->prefix = (size_t) prefix;
    563544        packet_dimension->content = (size_t) content;
    564545        packet_dimension->suffix = (size_t) suffix;
    565546        packet_dimension->addr_len = (size_t) addr_len;
    566        
    567547        return (int) result;
    568548}
    569549
    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        
     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 */
     559static 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        }
    594565        return EOK;
    595566}
    596567
    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        
     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 */
     577static 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        }
    620583        return EOK;
    621584}
Note: See TracChangeset for help on using the changeset viewer.