Giter Club home page Giter Club logo

msg_control's Introduction

msg_control

These helper functions manipulate socket ancillary data. They deal with msg_control and msg_conrollen member of msghdr and leave the rest of the structure alone.

/* Allocate buffer for control data. The buffer will be of size zero, however,
   to minimise number of (re)allocations you should specify the capacity in
   such a way as o fit all the ancillary data. Returns 0 in case of success,
   -1 if the buffer cannot be allocated. */
void msg_control_init (struct msghdr *hdr, size_t capacity);

/* Deallocate control data. */
void msg_control_term (struct msghdr *hdr);

/* Return property specified by level and type. If the size of the property
   is known in advance, 'size' may be set to NULL. Returns 0 in case of success,
   -1 if the property in question is not present. */
int msg_control_get (struct msghdr *hdr,
     int level, int type, void **data, size_t *size);

/* Add the property specified by level and type to the buffer. Returns 0 in case
   of success, -1 if additional space in the buffer cannot be allocated. */
int msg_control_set (struct msghdr *hdr,
     int level, int type, void *data, size_t size);

/* Remove the property specified by level and type from the buffer. Returns 0
   in case of success, -1 if the property in question is not present. */
int msg_control_rm (struct msghdr *hdr, int level, int type);

/* Use this function instead of sendmsg(2). */
ssize_t msg_control_send (int fd, struct msghdr *hdr, int flags);

/* Use this function instead of recvmsg(2). */
ssize_t msg_control_recv (int fd, struct msghdr *hdr, int *flags);

This project is licensed under MIT/X11 license.

msg_control's People

Contributors

sustrik avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.