| 1 | /* |
| 2 | * Copyright 2009 Red Hat Inc., Durham, North Carolina. |
| 3 | * All Rights Reserved. |
| 4 | * |
| 5 | * This library is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU Lesser General Public |
| 7 | * License as published by the Free Software Foundation; either |
| 8 | * version 2.1 of the License, or (at your option) any later version. |
| 9 | * |
| 10 | * This library is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * Lesser General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU Lesser General Public |
| 16 | * License along with this library; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | * |
| 19 | * Authors: |
| 20 | * "Daniel Kopecek" <[email protected]> |
| 21 | */ |
| 22 | |
| 23 | #pragma once |
| 24 | #ifndef _SEAP_H |
| 25 | #define _SEAP_H |
| 26 | |
| 27 | #include "_seap-message.h" |
| 28 | #include "sch_queue.h" |
| 29 | #include "../../../common/util.h" |
| 30 | #include "_seap-types.h" |
| 31 | |
| 32 | #ifndef EOPNOTSUPP |
| 33 | # define EOPNOTSUPP 1001 |
| 34 | #endif |
| 35 | |
| 36 | #ifndef ECANCELED |
| 37 | # define ECANCELED 1002 |
| 38 | #endif |
| 39 | |
| 40 | SEAP_CTX_t *SEAP_CTX_new(void); |
| 41 | void SEAP_CTX_init(SEAP_CTX_t *ctx); |
| 42 | void SEAP_CTX_free(SEAP_CTX_t *ctx); |
| 43 | |
| 44 | int SEAP_connect(SEAP_CTX_t *ctx); |
| 45 | int SEAP_listen(SEAP_CTX_t *ctx, int sd, uint32_t maxcli); |
| 46 | int SEAP_accept(SEAP_CTX_t *ctx, int sd); |
| 47 | |
| 48 | int SEAP_open(SEAP_CTX_t *ctx, const char *path, uint32_t flags); |
| 49 | SEXP_t *SEAP_read(SEAP_CTX_t *ctx, int sd); |
| 50 | int SEAP_write(SEAP_CTX_t *ctx, int sd, SEXP_t *sexp); |
| 51 | int SEAP_close(SEAP_CTX_t *ctx, int sd); |
| 52 | |
| 53 | int SEAP_openfd(SEAP_CTX_t *ctx, int fd, uint32_t flags); |
| 54 | int SEAP_openfd2(SEAP_CTX_t *ctx, int ifd, int ofd, uint32_t flags); |
| 55 | int SEAP_add_probe(SEAP_CTX_t *ctx, sch_queuedata_t *data); |
| 56 | |
| 57 | int SEAP_recvsexp(SEAP_CTX_t *ctx, int sd, SEXP_t **sexp); |
| 58 | int SEAP_recvmsg(SEAP_CTX_t *ctx, int sd, SEAP_msg_t **seap_msg); |
| 59 | |
| 60 | int SEAP_sendsexp(SEAP_CTX_t *ctx, int sd, SEXP_t *sexp); |
| 61 | int SEAP_sendmsg(SEAP_CTX_t *ctx, int sd, SEAP_msg_t *seap_msg); |
| 62 | |
| 63 | int SEAP_reply(SEAP_CTX_t *ctx, int sd, SEAP_msg_t *rep_msg, SEAP_msg_t *req_msg); |
| 64 | |
| 65 | int SEAP_senderr(SEAP_CTX_t *ctx, int sd, SEAP_err_t *err); |
| 66 | int SEAP_recverr(SEAP_CTX_t *ctx, int sd, SEAP_err_t **err); |
| 67 | int SEAP_recverr_byid(SEAP_CTX_t *ctx, int sd, SEAP_err_t **err, SEAP_msgid_t id); |
| 68 | |
| 69 | int SEAP_replyerr(SEAP_CTX_t *ctx, int sd, SEAP_msg_t *rep_msg, uint32_t e); |
| 70 | |
| 71 | int __SEAP_recvmsg_process_cmd (SEAP_CTX_t *ctx, int sd, SEAP_cmd_t *cmd); |
| 72 | |
| 73 | |
| 74 | #endif /* _SEAP_H */ |