| 86 |
/** A function that displays messages with the following parameters: |
/** A function that displays messages with the following parameters: |
| 87 |
|
|
| 88 |
axel: A pointer to the calling axel structure |
axel: A pointer to the calling axel structure |
| 89 |
verbosity: one of the VERBOSITY_* values |
rel: Importance of this message, may be used to supress some |
| 90 |
message: The message to display (already i18ned), will be freed upon returning |
message: The message to display (already i18ned), will be freed upon returning |
| 91 |
|
|
| 92 |
NULL for no message display |
NULL for no message display |
| 93 |
*/ |
*/ |
| 94 |
void (*message_handler)(const struct axel_struct* axel, int verbosity, const char* message); |
void (*message_handler)(const struct axel_struct* axel, message_relevance rel, const char* message); |
| 95 |
/** |
/** |
| 96 |
* A handler that displays the current download state. |
* A handler that displays the current download state. |
| 97 |
* May be called frequently. Is guaranteed to be called on state changes and messages. |
* May be called frequently. Is guaranteed to be called on state changes and messages. |
| 118 |
AXEL_FILESIZE size; // The full file size in Byte, or AXEL_SIZE_UNDETERMINED if the file size is not yet determined or undeterminable |
AXEL_FILESIZE size; // The full file size in Byte, or AXEL_SIZE_UNDETERMINED if the file size is not yet determined or undeterminable |
| 119 |
AXEL_TIME start_utime; // Start time in microseconds |
AXEL_TIME start_utime; // Start time in microseconds |
| 120 |
|
|
| 121 |
// The download's state, one of the AXEL_STATE_* constants |
int state; // The download's state, one of the AXEL_STATE_* constants |
|
int state; |
|
|
|
|
|
// Time to wait because of speed limit. |
|
|
int delay_time; |
|
| 122 |
|
|
| 123 |
// Messages |
// Messages |
| 124 |
message_queue_t msgs[1]; |
message_queue_t msgs[1]; |
| 126 |
}; |
}; |
| 127 |
typedef struct axel_struct axel_t; |
typedef struct axel_struct axel_t; |
| 128 |
|
|
| 129 |
// Main axel API: The following methods are used by the frontend. |
// Main axel API: The following methods form the axel API. |
| 130 |
void axel_init(axel_t* ax, const conf_t *conf); |
void axel_init(axel_t* ax, const conf_t *conf); |
| 131 |
_Bool axel_addurlstr(axel_t* axel, const char* urlstr, int priority); |
_Bool axel_addurlstr(axel_t* axel, const char* urlstr, int priority); |
| 132 |
axel_state axel_download(axel_t* axel); |
axel_state axel_download(axel_t* axel); |
| 133 |
void axel_destroy(axel_t* axel); |
void axel_destroy(axel_t* axel); |
| 134 |
|
|
| 135 |
// For other functions called only from axel's core, see messages.h |
// Called from axel's core, but not the main thread |
| 136 |
|
void axel_message_static(axel_t* axel, message_relevance rel, const char* msgstr); |
| 137 |
|
void axel_message_heap(axel_t* axel, message_relevance rel, char* msgstr); |
| 138 |
|
void axel_message_fmt(axel_t *axel, message_relevance rel, const char *format, ... ); |
| 139 |
|
void axel_message(axel_t* axel, message_t* msg); |
| 140 |
|
|