Subversion Repositories HelenOS

Rev

Rev 4743 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4743 Rev 4756
Line 55... Line 55...
55
/** @name Packet management system interface
55
/** @name Packet management system interface
56
 */
56
 */
57
/*@{*/
57
/*@{*/
58
 
58
 
59
/** Finds the packet mapping.
59
/** Finds the packet mapping.
60
 *  @param packet_id The packet identifier to be found. Input parameter.
60
 *  @param[in] packet_id The packet identifier to be found.
61
 *  @returns The found packet reference.
61
 *  @returns The found packet reference.
62
 *  @returns NULL if the mapping does not exist.
62
 *  @returns NULL if the mapping does not exist.
63
 */
63
 */
64
packet_t    pm_find( packet_id_t packet_id );
64
packet_t    pm_find( packet_id_t packet_id );
65
 
65
 
66
/** Adds the packet mapping.
66
/** Adds the packet mapping.
67
 *  @param packet The packet to be remembered. Input parameter.
67
 *  @param[in] packet The packet to be remembered.
68
 *  @returns EOK on success.
68
 *  @returns EOK on success.
69
 *  @returns EINVAL if the packet is not valid.
69
 *  @returns EINVAL if the packet is not valid.
70
 *  @returns EINVAL if the packet map is not initialized.
70
 *  @returns EINVAL if the packet map is not initialized.
71
 *  @returns ENOMEM if there is not enough memory left.
71
 *  @returns ENOMEM if there is not enough memory left.
72
 */
72
 */
Line 83... Line 83...
83
void    pm_destroy( void );
83
void    pm_destroy( void );
84
 
84
 
85
/** Add packet to the sorted queue.
85
/** Add packet to the sorted queue.
86
 *  The queue is sorted in the ascending order.
86
 *  The queue is sorted in the ascending order.
87
 *  The packet is inserted right before the packets of the same order value.
87
 *  The packet is inserted right before the packets of the same order value.
88
 *  @param first The first packet of the queue. May be NULL. Input parameter.
88
 *  @param[in] first The first packet of the queue. May be NULL.
89
 *  @param packet The packet to be added. Input parameter.
89
 *  @param[in] packet The packet to be added.
90
 *  @param order The packet order value. Input parameter.
90
 *  @param[in] order The packet order value.
91
 *  @param metric The metric value of the packet. Input parameter.
91
 *  @param[in] metric The metric value of the packet.
92
 *  @returns The first packet of the queue. The original first packet may be shifted by the new packet.
92
 *  @returns The first packet of the queue. The original first packet may be shifted by the new packet.
93
 *  @returns NULL if the packet is not valid.
93
 *  @returns NULL if the packet is not valid.
94
 */
94
 */
95
packet_t    pq_add( packet_t first, packet_t packet, size_t order, size_t metric );
95
packet_t    pq_add( packet_t first, packet_t packet, size_t order, size_t metric );
96
 
96
 
97
/** Finds the packet with the given order.
97
/** Finds the packet with the given order.
98
 *  @param first The first packet of the queue. Input parameter.
98
 *  @param[in] first The first packet of the queue.
99
 *  @param order The packet order value. Input parameter.
99
 *  @param[in] order The packet order value.
100
 *  @returns The packet with the given order.
100
 *  @returns The packet with the given order.
101
 *  @returns NULL if the first packet is not valid.
101
 *  @returns NULL if the first packet is not valid.
102
 *  @returns NULL if the packet is not found.
102
 *  @returns NULL if the packet is not found.
103
 */
103
 */
104
packet_t    pq_find( packet_t first, size_t order );
104
packet_t    pq_find( packet_t first, size_t order );
105
 
105
 
106
/** Inserts packet after the given one.
106
/** Inserts packet after the given one.
107
 *  @param packet The packet in the queue. Input parameter.
107
 *  @param[in] packet The packet in the queue.
108
 *  @param new_packet The new packet to be inserted. Input parameter.
108
 *  @param[in] new_packet The new packet to be inserted.
109
 *  @returns EOK on success.
109
 *  @returns EOK on success.
110
 *  @returns EINVAL if etiher of the packets is invalid.
110
 *  @returns EINVAL if etiher of the packets is invalid.
111
 */
111
 */
112
int pq_insert_after( packet_t packet, packet_t new_packet );
112
int pq_insert_after( packet_t packet, packet_t new_packet );
113
 
113
 
114
/** Detach the packet from the queue.
114
/** Detach the packet from the queue.
115
 *  @param packet The packet to be detached. Input parameter.
115
 *  @param[in] packet The packet to be detached.
116
 *  @returns The next packet in the queue. If the packet is the first one of the queue, this becomes the new first one.
116
 *  @returns The next packet in the queue. If the packet is the first one of the queue, this becomes the new first one.
117
 *  @returns NULL if there is no packet left.
117
 *  @returns NULL if there is no packet left.
118
 *  @returns NULL if the packet is not valid.
118
 *  @returns NULL if the packet is not valid.
119
 */
119
 */
120
packet_t    pq_detach( packet_t packet );
120
packet_t    pq_detach( packet_t packet );
121
 
121
 
122
/** Sets the packet order and metric attributes.
122
/** Sets the packet order and metric attributes.
123
 *  @param packet The packet to be set. Input parameter.
123
 *  @param[in] packet The packet to be set.
124
 *  @param order The packet order value. Input parameter.
124
 *  @param[in] order The packet order value.
125
 *  @param metric The metric value of the packet. Input parameter.
125
 *  @param[in] metric The metric value of the packet.
126
 *  @returns EOK on success.
126
 *  @returns EOK on success.
127
 *  @returns EINVAL if the packet is invalid..
127
 *  @returns EINVAL if the packet is invalid..
128
 */
128
 */
129
int pq_set_order( packet_t packet, size_t order, size_t metric );
129
int pq_set_order( packet_t packet, size_t order, size_t metric );
130
 
130
 
131
/** Sets the packet order and metric attributes.
131
/** Sets the packet order and metric attributes.
132
 *  @param packet The packet to be set. Input parameter.
132
 *  @param[in] packet The packet to be set.
133
 *  @param order The packet order value. Output parameter.
133
 *  @param[out] order The packet order value.
134
 *  @param metric The metric value of the packet. Ouput parameter.
134
 *  @param[out] metric The metric value of the packet.
135
 *  @returns EOK on success.
135
 *  @returns EOK on success.
136
 *  @returns EINVAL if the packet is invalid..
136
 *  @returns EINVAL if the packet is invalid..
137
 */
137
 */
138
int pq_get_order( packet_t packet, size_t * order, size_t * metric );
138
int pq_get_order( packet_t packet, size_t * order, size_t * metric );
139
 
139
 
140
/** Releases the whole queue.
140
/** Releases the whole queue.
141
 *  Detaches all packets of the queue and calls the packet_release() for each of them.
141
 *  Detaches all packets of the queue and calls the packet_release() for each of them.
142
 *  @param first The first packet of the queue. Input parameter.
142
 *  @param[in] first The first packet of the queue.
143
 *  @param packet_release The releasing function called for each of the packets after its detachment. Input parameter.
143
 *  @param[in] packet_release The releasing function called for each of the packets after its detachment.
144
 */
144
 */
145
void    pq_destroy( packet_t first, void ( * packet_release )( packet_t packet ));
145
void    pq_destroy( packet_t first, void ( * packet_release )( packet_t packet ));
146
 
146
 
147
/** Returns the next packet in the queue.
147
/** Returns the next packet in the queue.
148
 *  @param packet The packet queue member. Input parameter.
148
 *  @param[in] packet The packet queue member.
149
 *  @returns The next packet in the queue.
149
 *  @returns The next packet in the queue.
150
 *  @returns NULL if there is no next packet.
150
 *  @returns NULL if there is no next packet.
151
 *  @returns NULL if the packet is not valid.
151
 *  @returns NULL if the packet is not valid.
152
 */
152
 */
153
packet_t    pq_next( packet_t packet );
153
packet_t    pq_next( packet_t packet );
154
 
154
 
155
/** Returns the previous packet in the queue.
155
/** Returns the previous packet in the queue.
156
 *  @param packet The packet queue member. Input parameter.
156
 *  @param[in] packet The packet queue member.
157
 *  @returns The previous packet in the queue.
157
 *  @returns The previous packet in the queue.
158
 *  @returns NULL if there is no previous packet.
158
 *  @returns NULL if there is no previous packet.
159
 *  @returns NULL if the packet is not valid.
159
 *  @returns NULL if the packet is not valid.
160
 */
160
 */
161
packet_t    pq_previous( packet_t packet );
161
packet_t    pq_previous( packet_t packet );