Lines Matching refs:samsg
38 write_and_read(int s, sadb_msg_t *samsg, uint64_t *readbuf, int readlen, in write_and_read() argument
42 uint8_t msgtype = samsg->sadb_msg_type; in write_and_read()
43 pid_t pid = samsg->sadb_msg_pid; in write_and_read()
44 uint8_t seq = samsg->sadb_msg_seq; in write_and_read()
46 rc = write(s, samsg, SADB_64TO8(samsg->sadb_msg_len)); in write_and_read()
51 samsg = (sadb_msg_t *)readbuf; in write_and_read()
56 } while (samsg->sadb_msg_seq != seq || samsg->sadb_msg_pid != pid || in write_and_read()
57 samsg->sadb_msg_type != msgtype); in write_and_read()
59 if (samsg->sadb_msg_errno != expected) { in write_and_read()
60 errno = samsg->sadb_msg_errno; in write_and_read()
62 msgtypestr, samsg->sadb_x_msg_diagnostic, in write_and_read()
63 keysock_diag(samsg->sadb_x_msg_diagnostic)); in write_and_read()
81 sadb_msg_t *samsg; in main() local
169 samsg = (sadb_msg_t *)writebuf; in main()
170 samsg->sadb_msg_version = PF_KEY_V2; in main()
171 samsg->sadb_msg_type = SADB_UPDATE; in main()
172 samsg->sadb_msg_errno = 0; in main()
173 samsg->sadb_msg_satype = SADB_SATYPE_AH; in main()
174 samsg->sadb_msg_reserved = 0; in main()
175 samsg->sadb_msg_seq = 1; in main()
176 samsg->sadb_msg_pid = pid; in main()
177 samsg->sadb_msg_len = SADB_8TO64(sizeof (*samsg) + sizeof (*saext) + in main()
181 saext = (sadb_sa_t *)(samsg + 1); in main()
230 write_and_read(s, samsg, readbuf, sizeof (readbuf), experr, in main()
241 samsg->sadb_msg_type = SADB_GET; in main()
242 samsg->sadb_msg_len -= SADB_8TO64(sizeof (*kmcext)); in main()
245 write_and_read(s, samsg, readbuf, sizeof (readbuf), 0, "SADB_GET"); in main()
248 samsg = (sadb_msg_t *)readbuf; in main()
249 extptr = (uint64_t *)(samsg + 1); in main()
250 endptr = extptr + samsg->sadb_msg_len - SADB_8TO64(sizeof (*samsg)); in main()