Changeset b10460a in mainline for uspace/srv/net/tcp/service.c


Ignore:
Timestamp:
2015-08-07T21:39:00Z (9 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b688fd8
Parents:
6accc5cf
Message:

Add missing docblocks in network code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tcp/service.c

    r6accc5cf rb10460a  
    2727 */
    2828
    29 /** @addtogroup udp
     29/** @addtogroup tcp
    3030 * @{
    3131 */
     
    4444#include <loc.h>
    4545#include <macros.h>
     46#include <mem.h>
    4647#include <stdlib.h>
    4748
     
    5354#define NAME "tcp"
    5455
     56/** Maximum amount of data transferred in one send call */
    5557#define MAX_MSG_SIZE DATA_XFER_LIMIT
    5658
     
    6769static int tcp_cconn_create(tcp_client_t *, tcp_conn_t *, tcp_cconn_t **);
    6870
     71/** Connection callbacks to tie us to lower layer */
    6972static tcp_cb_t tcp_service_cb = {
    7073        .cstate_change = tcp_service_cstate_change,
     
    7275};
    7376
     77/** Sentinel connection callbacks to tie us to lower layer */
    7478static tcp_cb_t tcp_service_lst_cb = {
    7579        .cstate_change = tcp_service_lst_cstate_change,
     
    7781};
    7882
     83/** Connection state has changed.
     84 *
     85 * @param conn      Connection
     86 * @param arg       Argument (not used)
     87 * @param old_state Previous connection state
     88 */
    7989static void tcp_service_cstate_change(tcp_conn_t *conn, void *arg,
    8090    tcp_cstate_t old_state)
     
    108118}
    109119
     120/** Sentinel connection state has changed.
     121 *
     122 * @param conn      Connection
     123 * @param arg       Argument (not used)
     124 * @param old_state Previous connection state
     125 */
    110126static void tcp_service_lst_cstate_change(tcp_conn_t *conn, void *arg,
    111127    tcp_cstate_t old_state)
     
    169185}
    170186
     187/** Received data became available on connection.
     188 *
     189 * @param conn Connection
     190 * @param arg  Client connection
     191 */
    171192static void tcp_service_recv_data(tcp_conn_t *conn, void *arg)
    172193{
     
    176197}
    177198
     199/** Send 'data' event to client.
     200 *
     201 * @param cconn Client connection
     202 */
    178203static void tcp_ev_data(tcp_cconn_t *cconn)
    179204{
     
    192217}
    193218
     219/** Send 'connected' event to client.
     220 *
     221 * @param cconn Client connection
     222 */
    194223static void tcp_ev_connected(tcp_cconn_t *cconn)
    195224{
     
    205234}
    206235
     236/** Send 'conn_failed' event to client.
     237 *
     238 * @param cconn Client connection
     239 */
    207240static void tcp_ev_conn_failed(tcp_cconn_t *cconn)
    208241{
     
    218251}
    219252
     253/** Send 'conn_reset' event to client.
     254 *
     255 * @param cconn Client connection
     256 */
    220257static void tcp_ev_conn_reset(tcp_cconn_t *cconn)
    221258{
     
    231268}
    232269
    233 /** New incoming connection */
     270/** Send 'new_conn' event to client.
     271 *
     272 * @param clst Client listener that received the connection
     273 * @param cconn New client connection
     274 */
    234275static void tcp_ev_new_conn(tcp_clst_t *clst, tcp_cconn_t *cconn)
    235276{
     
    246287}
    247288
     289/** Create client connection.
     290 *
     291 * This effectively adds a connection into a client's namespace.
     292 *
     293 * @param client TCP client
     294 * @param conn   Connection
     295 * @param rcconn Place to store pointer to new client connection
     296 *
     297 * @return EOK on success or ENOMEM if out of memory
     298 */
    248299static int tcp_cconn_create(tcp_client_t *client, tcp_conn_t *conn,
    249300    tcp_cconn_t **rcconn)
     
    272323}
    273324
     325/** Destroy client connection.
     326 *
     327 * @param cconn Client connection
     328 */
    274329static void tcp_cconn_destroy(tcp_cconn_t *cconn)
    275330{
     
    278333}
    279334
     335/** Create client listener.
     336 *
     337 * Create client listener based on sentinel connection.
     338 * XXX Implement actual listener in protocol core
     339 *
     340 * @param client TCP client
     341 * @param conn   Sentinel connection
     342 * @param rclst  Place to store pointer to new client listener
     343 *
     344 * @return EOK on success or ENOMEM if out of memory
     345 */
    280346static int tcp_clistener_create(tcp_client_t *client, tcp_conn_t *conn,
    281347    tcp_clst_t **rclst)
     
    304370}
    305371
     372/** Destroy client listener.
     373 *
     374 * @param clst Client listener
     375 */
    306376static void tcp_clistener_destroy(tcp_clst_t *clst)
    307377{
     
    310380}
    311381
     382/** Get client connection by ID.
     383 *
     384 * @param client Client
     385 * @param id     Client connection ID
     386 * @param rcconn Place to store pointer to client connection
     387 *
     388 * @return EOK on success, ENOENT if no client connection with the given ID
     389 *         is found.
     390 */
    312391static int tcp_cconn_get(tcp_client_t *client, sysarg_t id,
    313392    tcp_cconn_t **rcconn)
     
    323402}
    324403
     404/** Get client listener by ID.
     405 *
     406 * @param client Client
     407 * @param id     Client connection ID
     408 * @param rclst  Place to store pointer to client listener
     409 *
     410 * @return EOK on success, ENOENT if no client listener with the given ID
     411 *         is found.
     412 */
    325413static int tcp_clistener_get(tcp_client_t *client, sysarg_t id,
    326414    tcp_clst_t **rclst)
     
    336424}
    337425
    338 
     426/** Create connection.
     427 *
     428 * Handle client request to create connection (with parameters unmarshalled).
     429 *
     430 * @param client   TCP client
     431 * @param epp      Endpoint pair
     432 * @param rconn_id Place to store ID of new connection
     433 *
     434 * @return EOK on success or negative error code
     435 */
    339436static int tcp_conn_create_impl(tcp_client_t *client, inet_ep2_t *epp,
    340437    sysarg_t *rconn_id)
     
    376473}
    377474
     475/** Destroy connection.
     476 *
     477 * Handle client request to destroy connection (with parameters unmarshalled).
     478 *
     479 * @param client  TCP client
     480 * @param conn_id Connection ID
     481 * @return EOK on success, ENOENT if no such connection is found
     482 */
    378483static int tcp_conn_destroy_impl(tcp_client_t *client, sysarg_t conn_id)
    379484{
     
    393498}
    394499
     500/** Create listener.
     501 *
     502 * Handle client request to create listener (with parameters unmarshalled).
     503 *
     504 * @param client  TCP client
     505 * @param ep      Endpoint
     506 * @param rlst_id Place to store ID of new listener
     507 *
     508 * @return EOK on success or negative error code
     509*/
    395510static int tcp_listener_create_impl(tcp_client_t *client, inet_ep_t *ep,
    396511    sysarg_t *rlst_id)
     
    430545}
    431546
     547/** Destroy listener.
     548 *
     549 * Handle client request to destroy listener (with parameters unmarshalled).
     550 *
     551 * @param client TCP client
     552 * @param lst_id Listener ID
     553 *
     554 * @return EOK on success, ENOENT if no such listener is found
     555 */
    432556static int tcp_listener_destroy_impl(tcp_client_t *client, sysarg_t lst_id)
    433557{
     
    446570}
    447571
     572/** Send FIN.
     573 *
     574 * Handle client request to send FIN (with parameters unmarshalled).
     575 *
     576 * @param client  TCP client
     577 * @param conn_id Connection ID
     578 *
     579 * @return EOK on success or negative error code
     580 */
    448581static int tcp_conn_send_fin_impl(tcp_client_t *client, sysarg_t conn_id)
    449582{
     
    462595}
    463596
     597/** Push connection.
     598 *
     599 * Handle client request to push connection (with parameters unmarshalled).
     600 *
     601 * @param client  TCP client
     602 * @param conn_id Connection ID
     603 *
     604 * @return EOK on success or negative error code
     605 */
    464606static int tcp_conn_push_impl(tcp_client_t *client, sysarg_t conn_id)
    465607{
     
    478620}
    479621
     622/** Reset connection.
     623 *
     624 * Handle client request to reset connection (with parameters unmarshalled).
     625 *
     626 * @param client  TCP client
     627 * @param conn_id Connection ID
     628 *
     629 * @return EOK on success or negative error code
     630 */
    480631static int tcp_conn_reset_impl(tcp_client_t *client, sysarg_t conn_id)
    481632{
     
    493644}
    494645
     646/** Send data over connection..
     647 *
     648 * Handle client request to send data (with parameters unmarshalled).
     649 *
     650 * @param client  TCP client
     651 * @param conn_id Connection ID
     652 * @param data    Data buffer
     653 * @param size    Data size in bytes
     654 *
     655 * @return EOK on success or negative error code
     656 */
    495657static int tcp_conn_send_impl(tcp_client_t *client, sysarg_t conn_id,
    496658    void *data, size_t size)
     
    510672}
    511673
     674/** Receive data from connection.
     675 *
     676 * Handle client request to receive data (with parameters unmarshalled).
     677 *
     678 * @param client  TCP client
     679 * @param conn_id Connection ID
     680 * @param data    Data buffer
     681 * @param size    Buffer size in bytes
     682 * @param nrecv   Place to store actual number of bytes received
     683 *
     684 * @return EOK on success or negative error code
     685 */
    512686static int tcp_conn_recv_impl(tcp_client_t *client, sysarg_t conn_id,
    513687    void *data, size_t size, size_t *nrecv)
     
    540714}
    541715
     716/** Create client callback session.
     717 *
     718 * Handle client request to create callback session.
     719 *
     720 * @param client  TCP client
     721 * @param iid     Async request ID
     722 * @param icall   Async request data
     723 */
    542724static void tcp_callback_create_srv(tcp_client_t *client, ipc_callid_t iid,
    543725    ipc_call_t *icall)
     
    555737}
    556738
     739/** Create connection.
     740 *
     741 * Handle client request to create connection.
     742 *
     743 * @param client   TCP client
     744 * @param iid      Async request ID
     745 * @param icall    Async request data
     746 */
    557747static void tcp_conn_create_srv(tcp_client_t *client, ipc_callid_t iid,
    558748    ipc_call_t *icall)
     
    594784}
    595785
     786/** Destroy connection.
     787 *
     788 * Handle client request to destroy connection.
     789 *
     790 * @param client   TCP client
     791 * @param iid      Async request ID
     792 * @param icall    Async request data
     793 */
    596794static void tcp_conn_destroy_srv(tcp_client_t *client, ipc_callid_t iid,
    597795    ipc_call_t *icall)
     
    607805}
    608806
     807/** Create listener.
     808 *
     809 * Handle client request to create listener.
     810 *
     811 * @param client   TCP client
     812 * @param iid      Async request ID
     813 * @param icall    Async request data
     814 */
    609815static void tcp_listener_create_srv(tcp_client_t *client, ipc_callid_t iid,
    610816    ipc_call_t *icall)
     
    646852}
    647853
     854/** Destroy listener.
     855 *
     856 * Handle client request to destroy listener.
     857 *
     858 * @param client   TCP client
     859 * @param iid      Async request ID
     860 * @param icall    Async request data
     861 */
    648862static void tcp_listener_destroy_srv(tcp_client_t *client, ipc_callid_t iid,
    649863    ipc_call_t *icall)
     
    659873}
    660874
     875/** Send FIN.
     876 *
     877 * Handle client request to send FIN.
     878 *
     879 * @param client   TCP client
     880 * @param iid      Async request ID
     881 * @param icall    Async request data
     882 */
    661883static void tcp_conn_send_fin_srv(tcp_client_t *client, ipc_callid_t iid,
    662884    ipc_call_t *icall)
     
    672894}
    673895
     896/** Push connection.
     897 *
     898 * Handle client request to push connection.
     899 *
     900 * @param client   TCP client
     901 * @param iid      Async request ID
     902 * @param icall    Async request data
     903 */
    674904static void tcp_conn_push_srv(tcp_client_t *client, ipc_callid_t iid,
    675905    ipc_call_t *icall)
     
    685915}
    686916
     917/** Reset connection.
     918 *
     919 * Handle client request to reset connection.
     920 *
     921 * @param client   TCP client
     922 * @param iid      Async request ID
     923 * @param icall    Async request data
     924 */
    687925static void tcp_conn_reset_srv(tcp_client_t *client, ipc_callid_t iid,
    688926    ipc_call_t *icall)
     
    698936}
    699937
     938/** Send data via connection..
     939 *
     940 * Handle client request to send data via connection.
     941 *
     942 * @param client   TCP client
     943 * @param iid      Async request ID
     944 * @param icall    Async request data
     945 */
    700946static void tcp_conn_send_srv(tcp_client_t *client, ipc_callid_t iid,
    701947    ipc_call_t *icall)
     
    750996}
    751997
     998/** Read received data from connection without blocking.
     999 *
     1000 * Handle client request to read received data via connection without blocking.
     1001 *
     1002 * @param client   TCP client
     1003 * @param iid      Async request ID
     1004 * @param icall    Async request data
     1005 */
    7521006static void tcp_conn_recv_srv(tcp_client_t *client, ipc_callid_t iid,
    7531007    ipc_call_t *icall)
     
    7981052}
    7991053
     1054/** Read received data from connection with blocking.
     1055 *
     1056 * Handle client request to read received data via connection with blocking.
     1057 *
     1058 * @param client   TCP client
     1059 * @param iid      Async request ID
     1060 * @param icall    Async request data
     1061 */
    8001062static void tcp_conn_recv_wait_srv(tcp_client_t *client, ipc_callid_t iid,
    8011063    ipc_call_t *icall)
     
    8511113}
    8521114
    853 #include <mem.h>
    854 
     1115/** Initialize TCP client structure.
     1116 *
     1117 * @param client TCP client
     1118 */
    8551119static void tcp_client_init(tcp_client_t *client)
    8561120{
     
    8611125}
    8621126
     1127/** Finalize TCP client structure.
     1128 *
     1129 * @param client TCP client
     1130 */
    8631131static void tcp_client_fini(tcp_client_t *client)
    8641132{
     
    8911159}
    8921160
     1161/** Handle TCP client connection.
     1162 *
     1163 * @param iid   Connect call ID
     1164 * @param icall Connect call data
     1165 * @param arg   Connection argument
     1166 */
    8931167static void tcp_client_conn(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    8941168{
     
    9611235}
    9621236
     1237/** Initialize TCP service.
     1238 *
     1239 * @return EOK on success or negative error code.
     1240 */
    9631241int tcp_service_init(void)
    9641242{
Note: See TracChangeset for help on using the changeset viewer.