/usr/include/libetpan/newsnntp.h is in libetpan-dev 1.6-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 | /*
* libEtPan! -- a mail stuff library
*
* Copyright (C) 2001, 2005 - DINH Viet Hoa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the libEtPan! project nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
/*
* $Id: newsnntp.h,v 1.21 2008/02/20 22:15:53 hoa Exp $
*/
#ifndef NEWSNNTP_H
#define NEWSNNTP_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#include <sys/types.h>
#include <time.h>
#include <libetpan/clist.h>
#include <libetpan/mailstream.h>
#include <libetpan/newsnntp_socket.h>
#include <libetpan/newsnntp_ssl.h>
#include <libetpan/newsnntp_types.h>
/*
newsnntp_new()
This function returns a new NNTP session.
@param progr_rate When downloading messages, a function will be called
each time the amount of bytes downloaded reaches a multiple of this
value, this can be 0.
@param progr_fun This is the function to call to notify the progress,
this can be NULL.
@return an NNTP session is returned.
*/
LIBETPAN_EXPORT
newsnntp * newsnntp_new(size_t nntp_progr_rate,
progress_function * nntp_progr_fun);
/*
newsnntp_free()
This function will free the data structures associated with
the NNTP session.
@param session NNTP session
*/
LIBETPAN_EXPORT
void newsnntp_free(newsnntp * session);
/*
newsnntp_set_logger() set a logger for the connection.
@param session NNTP session
@param logger logger function. See mailstream_types.h to know possible log_type values.
str is the log, data received or data sent.
@param logger_context parameter that is passed to the logger function.
@return the value of the timeout in seconds.
*/
LIBETPAN_EXPORT
void newsnntp_set_logger(newsnntp * session, void (* logger)(newsnntp * session, int log_type,
const char * str, size_t size, void * context), void * logger_context);
/*
newsnntp_set_progress_callback() set NNTP progression callbacks.
@param session NNTP session
@param progr_fun callback function.
*/
LIBETPAN_EXPORT
void newsnntp_set_progress_callback(newsnntp * f, mailprogress_function * progr_fun, void * context);
/*
newsnntp_set_timeout() set the network timeout of the NNTP session.
@param session NNTP session
@param timeout value of the timeout in seconds.
*/
LIBETPAN_EXPORT
void newsnntp_set_timeout(newsnntp * session, time_t timeout);
/*
newsnntp_get_timeout() get the network timeout of the NNTP session.
@param session NNTP session
@return value of the timeout in seconds.
*/
LIBETPAN_EXPORT
time_t newsnntp_get_timeout(newsnntp * session);
/*
newsnntp_connect()
This function will connect the NNTP session with the given stream.
@param session the NNTP session
@param s stream to use
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_connect(newsnntp * session, mailstream * s);
/*
newsnntp_quit() disconnect the NNTP session.
@param session NNTP session
*/
LIBETPAN_EXPORT
int newsnntp_quit(newsnntp * session);
/*
newsnntp_head() fetch the headers of an article.
@param session NNTP session
@param indx index of the article to fetch.
@param result the header data.
@param result_len the length of the result data.
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_head(newsnntp * session, uint32_t indx,
char ** result, size_t * result_len);
/*
newsnntp_head_free()
This function will free the data associated with an NNTP
article header.
@param str header data.
*/
LIBETPAN_EXPORT
void newsnntp_head_free(char * str);
/*
newsnntp_article() fetch the header and contents of an article.
@param session NNTP session
@param indx index of the article to fetch.
@param result the article data.
@param result_len the length of the result data.
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_article(newsnntp * session, uint32_t indx,
char ** result, size_t * result_len);
/*
newsnntp_article_by_message_id() fetch the header and contents
of an article by message id.
@param session NNTP session
@param msg_id ID of the article to fetch.
@param result The article data.
@param result_len The length of the result data.
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_article_by_message_id(newsnntp * session, char * msg_id,
char ** result, size_t * result_len);
/*
newsnntp_article_free()
This function will free the data associated with an NNTP
article.
@param str article data.
*/
LIBETPAN_EXPORT
void newsnntp_article_free(char * str);
/*
newsnntp_body() fetch the contents of an article.
@param session NNTP session
@param indx index of the article to fetch.
@param result body data.
@param result_len length of the result data.
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_body(newsnntp * session, uint32_t indx,
char ** result, size_t * result_len);
/*
newsnntp_body_free()
This function will free the data associated with an NNTP
article body.
@param str article body data.
*/
LIBETPAN_EXPORT
void newsnntp_body_free(char * str);
/*
newsnntp_mode_reader() switch the mode of the server to
reader mode.
@param session NNTP session
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_mode_reader(newsnntp * session);
/*
newsnntp_date() fetches the current Coordinated Universal
Time from the server's perspective.
@param session NNTP session
@param tm server's current time.
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_date(newsnntp * session, struct tm * tm);
/*
newsnntp_authinfo_username() sets the session's username.
@param session NNTP session
@param username username.
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_authinfo_username(newsnntp * session, const char * username);
/*
newsnntp_authinfo_password() sets the session's password.
@param session NNTP session
@param username password.
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_authinfo_password(newsnntp * session, const char * password);
/*
newsnntp_post() posts a message to a newsgroup.
@param session NNTP session
@param message the message data.
@param size the size of the message.
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_post(newsnntp * session, const char * message, size_t size);
/******************* requests ******************************/
/*
newsnntp_group() select a newsgroup and fetch info about it.
@param session NNTP session
@param groupname name of the newsgroup.
@param info information about the group.
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_group(newsnntp * session, const char * groupname,
struct newsnntp_group_info ** info);
/*
newsnntp_group_free()
This function will free the data associated with NNTP group
data.
@param info group info.
*/
LIBETPAN_EXPORT
void newsnntp_group_free(struct newsnntp_group_info * info);
/*
newsnntp_list() select a newsgroup and fetch info about it.
@param session NNTP session
@param result list of struct newsnntp_group_info *.
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_list(newsnntp * session, clist ** result);
/*
newsnntp_list_free()
This function will free the data associated with a list
of newsnntp_group_info *.
@param l the list of group info.
*/
LIBETPAN_EXPORT
void newsnntp_list_free(clist * l);
/*
newsnntp_list_overview_fmt() fetch the server's format
overview.
@param session NNTP session
@param result string describing the server's format
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_list_overview_fmt(newsnntp * session, clist ** result);
/*
newsnntp_list_overview_fmt_free()
This function will free the data associated with a list
obtained from newsnntp_list_overview_fmt()
@param l the list of format data.
*/
LIBETPAN_EXPORT
void newsnntp_list_overview_fmt_free(clist * l);
/*
newsnntp_list_active() fetch groups matching a wildmat string.
@param session NNTP session
@param wildmat an optional wildmat pattern string
@param result a list of struct newsnntp_group_info *
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_list_active(newsnntp * session, const char * wildmat, clist ** result);
/*
newsnntp_list_active_free()
This function will free the data associated with a list
obtained from newsnntp_list_active()
@param l the list of group data.
*/
LIBETPAN_EXPORT
void newsnntp_list_active_free(clist * l);
/*
newsnntp_list_active_times() fetches when the selected newsgroup
was created.
@param session NNTP session
@param result a list of struct newsnntp_group_time *
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_list_active_times(newsnntp * session, clist ** result);
/*
newsnntp_list_active_times_free()
This function will free the data associated with a list
obtained from newsnntp_list_active_times()
@param l the list of group time data.
*/
LIBETPAN_EXPORT
void newsnntp_list_active_times_free(clist * l);
/*
newsnntp_list_distribution() fetches a list of descriptions of
distributions known to the server.
@param session NNTP session
@param result a list of struct newsnntp_distrib_value_meaning *
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_list_distribution(newsnntp * session, clist ** result);
/*
newsnntp_list_distribution_free()
This function will free the data associated with a list
obtained from newsnntp_list_distribution()
@param l the list of distribution data.
*/
LIBETPAN_EXPORT
void newsnntp_list_distribution_free(clist * l);
/*
newsnntp_list_distrib_pats() fetches a list of canonical
distribution values. Good for figuring out what to put in the
Distribution header of an article being posted.
@param session NNTP session
@param result a list of struct newsnntp_distrib_default_value *
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_list_distrib_pats(newsnntp * session, clist ** result);
/*
newsnntp_list_distribution_free()
This function will free the data associated with a list
obtained from newsnntp_list_distrib_pats()
@param l the list of distribution data.
*/
LIBETPAN_EXPORT
void newsnntp_list_distrib_pats_free(clist * l);
/*
newsnntp_list_newsgroups() fetches a list of newsgroups and
their descriptions.
@param session NNTP session
@param pattern an optional wildmat pattern
@param result a list of struct newsnntp_group_description *
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_list_newsgroups(newsnntp * session, const char * pattern,
clist ** result);
/*
newsnntp_list_newsgroups_free()
This function will free the data associated with a list
obtained from newsnntp_list_newsgroups()
@param l the list of newsgroup data.
*/
LIBETPAN_EXPORT
void newsnntp_list_newsgroups_free(clist * l);
/*
newsnntp_list_subscriptions() fetches a default list of
subscriptions for new users of the server.
@param session NNTP session
@param result a list of newsgroup name strings
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_list_subscriptions(newsnntp * session, clist ** result);
/*
newsnntp_list_subscriptions_free()
This function will free the data associated with a list of
subscriptions.
@param l the list of newsgroup data.
*/
LIBETPAN_EXPORT
void newsnntp_list_subscriptions_free(clist * l);
/*
newsnntp_listgroup() fetches a list of all article numbers
for a particular group.
@param session NNTP session
@param group_name the group name
@param result a list of uint32_t article numbers
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_listgroup(newsnntp * session, const char * group_name,
clist ** result);
/*
newsnntp_listgroup_free()
This function will free the data associated with a list of
subscriptions.
@param l the list of article numbers.
*/
LIBETPAN_EXPORT
void newsnntp_listgroup_free(clist * l);
/*
newsnntp_xhdr_single() retrieves specific header fields from a
specific article.
@param session NNTP session
@param header the field name
@param result a list of struct newsnntp_xhdr_resp_item *.
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_xhdr_single(newsnntp * session, const char * header, uint32_t article,
clist ** result);
/*
newsnntp_xhdr_range() retrieves specific header fields from
a range of specific articles.
@param session NNTP session
@param header the field name
@param rangeinf the lower bound of the range
@param rangesup the upper bound of the range
@param result a list of struct newsnntp_xhdr_resp_item *.
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_xhdr_range(newsnntp * session, const char * header,
uint32_t rangeinf, uint32_t rangesup,
clist ** result);
/*
newsnntp_xhdr_free()
This function will free the data associated with a list of
struct newsnntp_xhdr_resp_item *.
@param l the list of article header responses.
*/
LIBETPAN_EXPORT
void newsnntp_xhdr_free(clist * l);
/*
newsnntp_xover_single() retrieves overview data for a specific
article.
@param session NNTP session
@param header the field name
@param result a list of struct newsnntp_xhdr_resp_item *.
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_xover_single(newsnntp * session, uint32_t article,
struct newsnntp_xover_resp_item ** result);
/*
newsnntp_xover_range() retrieves overview information for a
particular range of articles.
@param session NNTP session
@param header the field name
@param rangeinf the lower bound of the range
@param rangesup the upper bound of the range
@param result a list of struct newsnntp_xover_resp_item *.
@return the return code is one of NEWSNNTP_ERROR_XXX or
NEWSNNTP_NO_ERROR codes
*/
LIBETPAN_EXPORT
int newsnntp_xover_range(newsnntp * session, uint32_t rangeinf, uint32_t rangesup,
clist ** result);
void xover_resp_item_free(struct newsnntp_xover_resp_item * n);
/*
newsnntp_xover_resp_list_free()
This function will free the data associated with a list of
struct newsnntp_xover_resp_item *.
@param l the list of overview responses.
*/
LIBETPAN_EXPORT
void newsnntp_xover_resp_list_free(clist * l);
/* deprecated */
LIBETPAN_EXPORT
int newsnntp_authinfo_generic(newsnntp * session, const char * authentificator,
const char * arguments);
#ifdef __cplusplus
}
#endif
#endif
|